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.
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.
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.log("generating pdf...");
var doc = new jsPDF();
doc.text(20, 20, 'HELLO!');
doc.setFont("courier");
doc.setFontType("normal");
doc.text(20, 30, 'This is a PDF document generated using JSPDF.');
doc.text(20, 50, 'YES, Inside of PhoneGap!');
var pdfUriString = doc.output('datauristring');
console.log(pdfUriString);
var pdfOutContainer = jQuery("#pdfOutContainer");
pdfOutContainer.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.
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
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.
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
How would I go about adding this plugin to work with your code?
https://github.com/MrRio/jsPDF/jspdf....
Thanks,
Aeneas
Hi Aeneas -
The link you've provided seems to be broken.
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
And what problems do you have with above solution? -- https://getsatisfaction.com/apperyio/...
The solution supplied by yurri does not allow html conversion. I am not sure how to impement/reference the above addon code.