Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

PDF Generator HTML to PDF

Avatar

Level 5

Hello,

I came across this link which talks about capability of converting HTML to PDF in 'PDF Generator':

https://helpx.adobe.com/aem-forms/6-1/aem-document-services-programmatically.html?#PDFGeneratorServi...

I was trying to understand what the end result of this conversion would be - Does the conversion happen as is i.e. after conversion, when you open the PDF, the fully rendered HTML page will be displayed in the PDF? Or the PDF will contain the HTML markup code?

Or is it similar to PDF rewriter functionality in AEM which uses xslt-fo to design a pdf based on content from the markup?

I had a requirement where a PDF needs to be generated based on data from custom XML/ HTML and was wondering whether PDF generator could be used for that.

Also, is this something that comes bundled with AEM?

Thanks.

7 Replies

Avatar

Level 9

Hi Jake,

xsl fo is rendering for PDF. I am pretty sure(100%)  PDF generator meets your need. Get an reconfirmation by posting at right SME at  http://help-forums.adobe.com/content/adobeforums/en/experience-manager-forum/aem-forms.html

Thanks,

Avatar

Level 10

That article talks about building a custom bundle that uses PDFBOX - an Apache API for PDF documents.

https://pdfbox.apache.org/

Like any AEM service  - you can add Java libs to create custom services that are not available out of the box. 

Avatar

Community Advisor

jakej40603950 wrote...

Hello,

I came across this link which talks about capability of converting HTML to PDF in 'PDF Generator':

https://helpx.adobe.com/aem-forms/6-1/aem-document-services-programmatically.html?#PDFGeneratorServi...

I was trying to understand what the end result of this conversion would be - Does the conversion happen as is i.e. after conversion, when you open the PDF, the fully rendered HTML page will be displayed in the PDF? Or the PDF will contain the HTML markup code?

Or is it similar to PDF rewriter functionality in AEM which uses xslt-fo to design a pdf based on content from the markup?

I had a requirement where a PDF needs to be generated based on data from custom XML/ HTML and was wondering whether PDF generator could be used for that.

Also, is this something that comes bundled with AEM?

Thanks.

 

If you want to screen capture the entire page then you can look into Phantom JS. It has its own server, you just need to pass your web url and specify the format then it will SCREEN CAPTURE the entire page. Also, I had issue with PDFBox few years back and I switched to iText framework.

http://stackoverflow.com/questions/30713657/how-to-run-phantomjs-as-a-server-and-call-it-remotely

http://phantomjs.org/

https://www.joecolantonio.com/2014/10/14/how-to-install-phantomjs/

 

I've used this with CQ 5.6.1 and it worked like a charm.

Thank you all for the answers on this.

I was definitely thinking of a custom solution (using PDFBox etc) for this as an option.

But if there was an ootb solution, would have preferred to use that as an option.

Can an adaptive document be used for this? Is it capable of having dynamic data loaded into it? The data in the XML is coming from REST services, so if adaptive documents supports dynamic data then at run time, all the required data can be loaded into it  and the document itself rendered as a pdf? i.e. if aem supports rendering of the document as a PDF.

Avatar

Administrator

Moving this Question to AEM forms topic so that contextual experts can further help you.

~kautuk



Kautuk Sahni

Avatar

Level 5

Thanks Kautik.

If there's a possible ootb (-ish) solution for this it'll be of great help.

I guess adaptive document / pages should be convertible to PDF (either through http://blogs.adobe.com/sunil/2013/04/29/creating-pdf-output-in-adobe-cq/ or through PDF generator? - let me know if wrong).

The question is on how to get data from services (say osgi ones) into adaptive documents. I could see in the documentation that data dictionary can be used for loading adaptive docs with dynamic data. But data dictionary seems to be able to fetch data mainly from static xmls. Is there a way to load it from services?

Thanks

Avatar

Employee

If your document needs to be only in PDF then you could make use of Output service (also part of AEM Forms as PDF Generator). You will need to create a document template before hand into which the XML will be merged to produce the PDF. You could also get the HTML output of the same data merged template, though keep in mind that HTML will not be responsive and will be PDF like.