Page 1 of 3

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

Posted: Sun Aug 17, 2014 10:09 pm
by Jake Hare7049642

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.


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

Posted: Mon Aug 18, 2014 2:12 am
by Yurii Orishchuk

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.


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

Posted: Tue Dec 16, 2014 2:46 am
by Bhupinder Chawla

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


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

Posted: Tue Dec 16, 2014 5:50 am
by Yurii Orishchuk

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.


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

Posted: Mon Jan 19, 2015 1:35 am
by Aeneas McBurney

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


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

Posted: Mon Jan 19, 2015 2:01 am
by Aeneas McBurney

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

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

Thanks,
Aeneas


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

Posted: Mon Jan 19, 2015 6:25 am
by Illya Stepanov

Hi Aeneas -

The link you've provided seems to be broken.


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

Posted: Mon Jan 19, 2015 7:27 am
by Aeneas McBurney

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


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

Posted: Mon Jan 19, 2015 11:30 am
by Illya Stepanov

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


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

Posted: Mon Jan 19, 2015 5:34 pm
by Aeneas McBurney

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