Jake Hare7049642
Posts: 0
Joined: Sun Aug 17, 2014 10:09 pm

Appery.io instructions to generate a pdf from the front end

I've seen it but can't find where the Appery.io documentation is to allow a user to create a pdf from the front end. Does someone know where that is?

Thanks.

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Appery.io instructions to generate a pdf from the front end

Hi Jake,

Currently there is no documentation how to work with pdf in appery.io.

But you can use following solution:

1 Add HTML component, set dimentions for it "auto" and "auto".

2 Fill component HTML with following code:

pre

<iframe width="100%" height="500px" id="pdfOutContainer"</iframe

/pre

3 Add button to the page and add JS click event handler with following code:

pre

console&#46;log("generating pdf&#46;&#46;&#46;");

var doc = new jsPDF();

doc&#46;text(20, 20, 'HELLO!');

doc&#46;setFont("courier");
doc&#46;setFontType("normal");
doc&#46;text(20, 30, 'This is a PDF document generated using JSPDF&#46;');
doc&#46;text(20, 50, 'YES, Inside of PhoneGap!');

var pdfUriString = doc&#46;output('datauristring');
console&#46;log(pdfUriString);

var pdfOutContainer = jQuery("#pdfOutContainer");
pdfOutContainer&#46;attr("src", pdfUriString);

/pre

That's all. After you clicked on the button you will get your PDF in the browser if it supports.

Regards.

Bhupinder Chawla
Posts: 0
Joined: Thu Aug 28, 2014 1:21 am

Appery.io instructions to generate a pdf from the front end

Hi Yurii,

I tried the above but it does not work. The first alert "generating pdf" is fine but the second one pdfUriString does not show up!

Do I need to include any files anywhere? If yes, where and what is the syntax.

Also, how can I use this PDF to email? All these work on iPhone / Android devices.

Thanks as always for your time!

Best Regards
Bhupinder Chawla

Yurii Orishchuk
Posts: 0
Joined: Fri Feb 14, 2014 8:20 am

Appery.io instructions to generate a pdf from the front end

Hi Bhupinder,

You should add "jsPDF" source code to new JS asset.

For example you can get this JS file here:
https://github.com/MrRio/jsPDF

Regards.

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

Appery.io instructions to generate a pdf from the front end

Hi Yurri,

What do you mean by

"You should add "jsPDF" source code to new JS asset"

Can you please explain how this is done?

Thanks,
Aeneas

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

Appery.io instructions to generate a pdf from the front end

How would I go about adding this plugin to work with your code?

https://github.com/MrRio/jsPDF/jspdf....

Thanks,
Aeneas

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

Appery.io instructions to generate a pdf from the front end

Hi Aeneas -

The link you've provided seems to be broken.

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

Appery.io instructions to generate a pdf from the front end

Hi,

Sorry it should be this

https://github.com/MrRio/jsPDF/blob/m...

I am trying to create a pdf file from an html document or string.

THanks,
Aeneas

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

Appery.io instructions to generate a pdf from the front end

And what problems do you have with above solution? -- https://getsatisfaction.com/apperyio/...

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

Appery.io instructions to generate a pdf from the front end

The solution supplied by yurri does not allow html conversion. I am not sure how to impement/reference the above addon code.

Return to “Issues”