Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Importing Server Script Libraries

Hi,

I am trying to import a js library (pdfMake from https://github.com/bpampuch/pdfmake) and use but when I reference it I get these errors

18.1.2015, 10:06:42 AM: Script CreateInvoice: ReferenceError: pdfMake is not defined ( @ 3 : 0 ) - pdfMake.createPdf(docDefinition).open();

The library is showing as pdfMake under libraries but I don't appear to be referencing correctly. Can you please help?

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Importing Server Script Libraries

Hi Aeneas -

Could you please clarify how exactly you have imported this JS inside your project?
Have you declare the document-definition-object as stated in their documentations?

Aeneas McBurney
Posts: 0
Joined: Mon Jun 16, 2014 7:49 am

Importing Server Script Libraries

I am trying to import the js files using the import button but it doesn't seem to work unless I copy and paste onto the script page.

What I am trying to achieve is to create a pdf file from an html document or string. Is this possible?

Thanks,
Aeneas

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

Importing Server Script Libraries

Are you trying from here:
Image

pakbull6772540
Posts: 0
Joined: Sun Mar 30, 2014 4:08 pm

Importing Server Script Libraries

Hi, trying to use the pdfmake.js javascript library.

I have created a simple html file and the pdf gets created. Simple.

However, when included in appery, it generates this error while loading:

appery.js:2171 Uncaught TypeError: _.isTrueObject is not a function

around this code snippet:
Apperyio.processSelectMenu = function (screen) {
var ctx;
if (screen) {
if (.isTrueObject(screen)) {
ctx = $(screen);
} else if (.isString(screen)) {
ctx = $("#" + screen);
}
}

This looks like a very useful library and it works outside of appery, but somehow appery compiler is not liking something. I have created a simple blank jquery app to use so no other code or library present.

Can you tell why Appery is giving an error when using it.

pakbull6772540
Posts: 0
Joined: Sun Mar 30, 2014 4:08 pm

Importing Server Script Libraries

were you able to use this library

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Importing Server Script Libraries

Hello,

Please clarify, what project type do you use AngularJS or JQM? When do you get that error, after app starting of after running pdfmake?

pakbull6772540
Posts: 0
Joined: Sun Mar 30, 2014 4:08 pm

Importing Server Script Libraries

It is JQUERY app. When on appery development ask to Export Build ipa, it does not complete and breaks down with the error above. So the app never comes up. Take out the pdfmake javascript (manually added and tried with both minified and normal versions) and app compiles fine.

Somehow the compiler does not like the pdfmake js files.

pakbull6772540
Posts: 0
Joined: Sun Mar 30, 2014 4:08 pm

Importing Server Script Libraries

Any ideas yet?

Serhii Kulibaba
Posts: 150
Joined: Tue Aug 27, 2013 1:47 pm

Importing Server Script Libraries

We are very sorry, but this is something outside the scope (http://devcenter.appery.io/support-po...) of our standard support.
Please check any another library for that, e.g.:
https://parall.ax/products/jspdf

Return to “Issues”