Liferay PDF generation from HTML using flying saucer

Liferay PDF generation from HTML using flying saucer

Objective:

Generate PDF content in liferay using html content. Generally we use itext library to generate pfd. When we use itext library we need to write so much java code to prepare PDF. I have done example which generate PDF by using html.
I am using one of library called flying saucer from this we can convert xhtm or html content as PDF.
We can also apply CSSto html so that same view we can get in PDF. For more details you can follow the link.

Download porlet from following link


In download link I am providing .war and source code.
If you want use .war file simply download war file and place into your liferay portal deploy directory then it will be deployed and portlet is available in sample category and portlet name is Pdf Action.
I have done simple example so that you can get idea to generate PDF using html.
I just hard code some HTML table in action class I am passing html content to flying saucer it will convert the html to PDF.
You can go through the code you will get more info.
I have used liferay 6.1 CE.
Note:
If you are using lower version you just copy portlet class code and jar files to you existed portlet. Otherwise portlet won’t be deployed.

If you get any problem in download file is not able to view or no data in download file please refer this following link

https://www.liferay.com/community/forums/-/message_boards/message/31500678




Share on Google Plus

About Meera Prince

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

3 comments:

  1. Hi i download pdfaction portlet and tried to my eclipse, it shows the following error,
    Oct 1, 2013 6:29:31 AM org.xhtmlrenderer.util.XRLog log
    INFO: Using CSS implementation from: org.xhtmlrenderer.context.StyleReference

    ReplyDelete
  2. Hi there is some problem with you plugin.please refer this thread
    https://www.liferay.com/community/forums/-/message_boards/message/31500678

    ReplyDelete