Convert AEM page to PDF

Avatar

Avatar
Boost 10
Level 3
Love_Sharma
Level 3

Likes

12 likes

Total Posts

49 posts

Correct reply

4 solutions
Top badges earned
Boost 10
Ignite 5
Ignite 3
Ignite 1
Validate 1
View profile

Avatar
Boost 10
Level 3
Love_Sharma
Level 3

Likes

12 likes

Total Posts

49 posts

Correct reply

4 solutions
Top badges earned
Boost 10
Ignite 5
Ignite 3
Ignite 1
Validate 1
View profile
Love_Sharma
Level 3

29-07-2018

Hi all,

I want to convert AEM html page to Pdf (using AEM 6.4)  and a link will be provided to users for to download that Pdf.

I have gone through forum already and found sources which I don't want to use like PDF generator (need licence Adobe Acrobat)  , PDFbox API (some restriction with JavaScript on the page)  and iTextpdf (need to expose code which I can't).

Could anyone share approach what else could be used (best if that is free).

Thanks in advance

Sharma

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,322 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile

Avatar
Coach
MVP
Arun_Patidar
MVP

Likes

1,442 likes

Total Posts

3,322 posts

Correct reply

941 solutions
Top badges earned
Coach
Contributor 2
Ignite 10
Give Back 700
Boost 1000
View profile
Arun_Patidar
MVP

04-08-2018

Hi,

As sachinarora​ suggested, you can go with above option if you don't want user to save pdf via print option then you can use Java API e.g. GitHub - wooio/htmltopdf-java: An HTML to PDF conversion library written in Java, based on wkhtmltop...

You may create a generic servlet with selector says "pdf", and can create download link like mysite/my/page.pdf.html.

Whenever this servlet will be called himl page will be converted into pdf using java API and pdf can be serve as pdf in browser or as a attachment.

matts44062041

Hello,

I'm also having this issue and followed the documentation provided however the Core bundle for my project will not start with the following error:

14.02.2020 15:59:55.229 *INFO* [FelixDispatchQueue] org.apache.felix.framework FrameworkEvent PACKAGES REFRESHED
14.02.2020 15:59:58.712 *ERROR* [qtp1371432053-74] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Unable to resolve com.aem.company-kds.core [553](R 553.1): missing requirement [com.aem.company-kds.core [553](R 553.1)] osgi.wiring.package; (osgi.wiring.package=io.woo.htmltopdf) Unresolved requirements: [[com.aem.company-kds.core [553](R 553.1)] osgi.wiring.package; (osgi.wiring.package=io.woo.htmltopdf)])
org.osgi.framework.BundleException: Unable to resolve com.aem.company-kds.core [553](R 553.1): missing requirement [com.aem.company-kds.core [553](R 553.1)] osgi.wiring.package; (osgi.wiring.package=io.woo.htmltopdf) Unresolved requirements: [[com.aem.company-kds.core [553](R 553.1)] osgi.wiring.package; (osgi.wiring.package=io.woo.htmltopdf)]

I've tried all versions of the htmltopdf jar with no luck.

Is this still supported?

Thanks in advance for any assistance.

matts44062041
Hello,

Answers (2)

Answers (2)

Avatar

Avatar
Level 1
GregMcGee
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile

Avatar
Level 1
GregMcGee
Level 1

Likes

0 likes

Total Posts

2 posts

Correct reply

0 solutions
View profile
GregMcGee
Level 1

01-04-2020

The only PDF generator on the market today is XpGenerator.  It is offered by my company Xpediant Digital.  It is a full function tool that can:

1.  Create pdf's of individual pages or an entire site

2.  Can automatically generate pdf's for desktop, tablet, and mobile

3.  Can be configured to mimic javascript commands to simulate opening tabs, carousels, and expand accordions

4.  The interface is immediately familiar - as it functions completely within your AEM instance

5.  Gives you flexibility in output - individual page pdf's or complete site files

6.  Custom coversheets to make archiving easy

Let me know if you'd like to take a look or hear more.

Greg McGee - Vice President of Digital Transformation

gmcgee@xpediantsolutions.com

612 845 0860

Avatar

Avatar
Validate 1
Level 2
sachinarora
Level 2

Likes

2 likes

Total Posts

10 posts

Correct reply

1 solution
Top badges earned
Validate 1
Give Back 3
Give Back
Boost 1
Affirm 1
View profile

Avatar
Validate 1
Level 2
sachinarora
Level 2

Likes

2 likes

Total Posts

10 posts

Correct reply

1 solution
Top badges earned
Validate 1
Give Back 3
Give Back
Boost 1
Affirm 1
View profile
sachinarora
Level 2

04-08-2018

I have an approach which might work.You have to do 2 things in it.

1. As you have mentioned a link will be provided to users, you can add a query parameter in URLs of a page like /home.html?print=page. In Javascript you can give a condition to run window.print() in case print == page.It will automatically pop up a window for user to save it as PDF or print page.

2. Add media rule in CSS for print to control content that needs to be added in PDF. Reference URL