Foros de discusión

Convert my HTML code in PDF Liferay 7

thumbnail
Hisham Zoghbi, modificado hace 6 años.

Convert my HTML code in PDF Liferay 7

Junior Member Mensajes: 32 Fecha de incorporación: 28/03/17 Mensajes recientes
Hello Guys,

Can I convert my Code from view.jsp to PDF und then send it per E-Mail? If so then plz with an example oder links that could help.

Thanks a lot

Sent from my iPhone with Liferay.com Forums
thumbnail
Jorge Díaz, modificado hace 6 años.

RE: Convert my HTML code in PDF Liferay 7

Liferay Master Mensajes: 753 Fecha de incorporación: 9/01/14 Mensajes recientes
In the past, in some projects, before using Liferay, I used following java library to transform from HTML to PDF: https://github.com/flyingsaucerproject/flyingsaucer/blob/master/README.md

But it seems it is not longer maintained, it only supports CSS 2.1
thumbnail
Neil Griffin, modificado hace 6 años.

RE: Convert my HTML code in PDF Liferay 7

Liferay Legend Mensajes: 2655 Fecha de incorporación: 27/07/05 Mensajes recientes
The Liferay Faces project maintains the jsf-export-pdf-portlet demo which utilizes the following dependency to convert HTML to PDF:
		<dependency>
			<groupid>org.xhtmlrenderer</groupid>
			<artifactid>core-renderer</artifactid>
			<version>R8</version>
		</dependency>


The code in PDFUtil.java shows how to do the conversion.
thumbnail
Hisham Zoghbi, modificado hace 6 años.

R: Convert my HTML code in PDF Liferay 7

Junior Member Mensajes: 32 Fecha de incorporación: 28/03/17 Mensajes recientes
Thanks for the reply and the infos. But how can I import the dependencies if I'm using Liferay 7GA with Gradle Tool?


Sent from my iPhone with Liferay.com Forums
thumbnail
Jorge Díaz, modificado hace 6 años.

RE: Convert my HTML code in PDF Liferay 7

Liferay Master Mensajes: 753 Fecha de incorporación: 9/01/14 Mensajes recientes
For gradle tool, include following dependence:
compile group: 'org.xhtmlrenderer', name: 'core-renderer', version: 'R8'

More info see: http://mvnrepository.com/artifact/org.xhtmlrenderer/core-renderer/R8

The library used in that jsf-export-pdf-portlet example (org.xhtmlrenderer) is the same library I said in my previous comment (flying saucer).

See:
So you will have problems with CSS3 or not xhtml code.

If you have problems with non xhtml code you can always use jtidy library to convert html to xhtml (http://jtidy.sourceforge.net/)
thumbnail
Hisham Zoghbi, modificado hace 6 años.

R: Convert my HTML code in PDF Liferay 7

Junior Member Mensajes: 32 Fecha de incorporación: 28/03/17 Mensajes recientes
Thank you all for the perfect information.

Sent from my iPhone with Liferay.com Forums