YaHP Converter (Yet another Html to Pdf converter) v1.3 (21/11/2011)

 New 25/11/2011!Sample Da Linux French Page

 New 25/11/2011!Sample freecode.com


 YaHP is a java library which permits to convert an html document into a pdf document.


 YaHP is licensed under the LGPL (GNU).


 YaHP use a pluggable renderer system.

It had in previous versions 4 renderer, in the 1.2.19 and 1.2.19a version only the renderer based on flying saucer is available. Jar is now smaller.

Source code

The source code is available through github.

Issues

You can log any issue in the dedicated section.

Old renderer properties (not available in 1.2.19):

  • The swing renderer, most stable, good rendering, can set header/footer, choose page size.
  • The OpenOffice.org renderer, average rendering, cannot set header footer nor page size.(worst renderer)
  • The firefox renderer, best rendering, can set header/footer, choose page size, must patch and compile a version of firefox, tested only on linux. Download pre-compiled version of the patched firefox (compiled on ubuntu dapper)mozila-print.tar.gz (08/04/2006)

To use the openoffice.org renderer, you must first launch openoffice in listen mode like this:

oowriter "-accept=socket,port=8100;urp;"
(with the quotes), then set the correct properties (see CSimpleConversion.java).

To use the firefox renderer, you must first download the firefox source : firefox-1.5.0.1-source.tar.bz2 at http://www.mozilla.org/ , then patch it with the files "layout.printing.nsPrintEngine.diff" and "layout.printing.nsPrintEngineH.diff", then compile it by issuing :

"./configure --prefix=/yourchoosenpath/mozilla-print/ --disable-logging --disable-tests --disable-oji --disable-view-source --disable-accessibility --disable-composer --disable-ldap --enable-canvas --disable-gnomeui --enable-application=browser --with-user-appdir=.print.mozilla --enable-system-cairo", then "make install"

Copy the sh script "fireprint" in /yourchoosenpath/mozilla-print/, modify the path inside the script, then set the correct properties (see CSimpleConversion.java). --script refer to the path /yourchoosenpath/mozilla-print/fireprint.

You also need ps2pdf installed and in the path.

 New 21/03/2009!Sample pdf with colors/tables/fonts embedded/alignment/non-latin alphabet New ! source

 New 21/03/2009!Sample pdf with pagebreaks

 Sample html with pagebreaks (use to generate the previous pdf)

 New 21/03/2009!Sample pdf with listing tables with automatic row break

 Sample html with listing tables with automatic row break (use to generate the previous pdf)

 New 21/03/2009!Sample pdf with watermark

 Sample html with watermark (use to generate the previous pdf)

 Sample image used as watermark (use to generate the previous pdf)

 New 18/03/2009!Sample Freecode

 New 18/03/2009!Sample Freshmeat

 New 21/03/2009!Sample This page

 Javadoc

Getting started

Copy the jar from $YAHP_HOME/YaHPConverter/lib/ and $YAHP_HOME/YaHPSample/lib/ in the classpath.

Or rebuild it by issuing 'ant' in $YAHP_HOME/YaHPConverter/ the jars will be in $YAHP_HOME/YaHPConverter/Run and $YAHP_HOME/YaHPConverter/lib/ for the dependancies after the build.

Example usage: (see CSimpleConversion.java)

	// new converter
	CYaHPConverter converter = new CYaHPConverter();
	// save pdf in outfile
	File fout = new File(outfile);
	FileOutputStream out = new FileOutputStream(fout);
	// contains configuration properties
	Map properties = new HashMap();
	// list containing header/footer
	List			 headerFooterList = new ArrayList();
	// add header/footer
	headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(
			"<table width=\"100%\"><tbody><tr><td align=\"left\">"+
			"Generated with YaHPConverter.</td><td align=\"right\">Page <pagenumber>/<"+
			"pagecount></td></tr></tbody></table>",
			IHtmlToPdfTransformer.CHeaderFooter.HEADER));
	headerFooterList.add(new IHtmlToPdfTransformer.CHeaderFooter(
			"© 2009 Quentin Anciaux",
			IHtmlToPdfTransformer.CHeaderFooter.FOOTER));
	properties.put(IHtmlToPdfTransformer.PDF_RENDERER_CLASS,
			IHtmlToPdfTransformer.FLYINGSAUCER_PDF_RENDERER);
	properties.put(IHtmlToPdfTransformer.FOP_TTF_FONT_PATH, fontPath);
	converter.convertToPdf(new URL(url),
		IHtmlToPdfTransformer.A4P, headerFooterList, out,
		properties);
	out.flush();
	out.close();
			

To change the page size after a page break, set the attribute "size" of the <yahp:pb /> attribute. Example:


  

!! Download v1.3 (tar.gz) - 21/11/2011 !!

Changes:

  

!! Download v1.2.20c (tar.gz) - 10/05/2011 !!

Changes:

 Download v1.2.20b (tar.gz) - 17/01/2011

Changes:

 Download v1.2.20a (tar.gz) - 18/12/2009

Changes:

 Download v1.2.20 (tar.gz) - 17/12/2009

Changes:

 Download v1.2.19d (tar.gz) - 16/06/2009

Changes:

 Download v1.2.19c (tar.gz) - 07/05/2009

Changes:

 Download v1.2.19b (tar.gz) - 01/05/2009

Changes:

 Download v1.2.19a (tar.gz) - 18/03/2009

Changes:

 Download v1.2.19 (tar.gz) - 13/03/2009

Changes:

 Download v1.2.18c (tar.gz) - 07/07/2008

Changes:

 Download v1.2.18b (tar.gz) - 05/07/2008

Changes:

 Download v1.2.18a (tar.gz) - 04/07/2008

Changes:

 Download v1.2.18 (tar.gz) - 04/07/2008

Changes:

 Download v1.2.18-pre1 (tar.gz) - 01/07/2008

Changes:

 Download v1.2.17 (tar.gz) - 02/07/2007

Changes:

 Download v1.2.16 (tar.gz) - 19/06/2007

Changes:

 Download v1.2.15 (tar.gz) - 17/06/2007

Changes:

 Download v1.2.14 (tar.gz) - 15/06/2007

Changes:

 Download v1.2.13 (tar.gz) - 13/06/2007

Changes:

 Download v1.2.12 (tar.gz) - 11/06/2007

Changes:

 Download v1.2.11 (tar.gz) - 11/05/2007

Changes:

 Download v1.2.10 (tar.gz) - 26/04/2007

Changes:

 Download v1.2.9 (tar.gz) - 24/04/2007

Changes:

 Download v1.2.8 (tar.gz) - 19/04/2007

Changes:

 Download v1.2.7 (tar.gz) - 13/04/2007

Changes:

 v1.2.6 (tar.gz) - 13/04/2007 (NUKED)

Changes:

 Download v1.2.5 (tar.gz) - 12/04/2007

Changes:

 Download v1.2.4 (tar.gz) - 11/04/2007

Changes:

 Download v1.2.3 (tar.gz) - 09/04/2007

Changes:

 Download v1.2.2 (tar.gz) - 16/03/2007

Changes:

 Download v1.2.1 (tar.gz) - 05/01/2007

Changes:

 Download v1.2 (tar.gz) - 07/12/2006

Changes:

 Download v1.1beta2 (tar.gz) - 10/08/2006

Changes:

 Download v1.0 (tar.gz) - 21/07/2006

Changes:

 Download v0.99 (tar.gz) - 05/07/2006

Changes:

  Download v0.98 (tar.gz) - 05/07/2006 (N/A)

Changes:

 Download v0.97 (tar.gz) - 23/06/2006

Changes:

 Download v0.96 (tar.gz) - 19/06/2006

Changes:

 Download v0.95 (tar.gz) - 17/06/2006

Changes:

 Download v0.94 (tar.gz) - 08/06/2006

Changes:

 Download v0.93 (tar.gz) - 15/04/2006

Changes:

 Download v0.92 (tar.gz) - 14/04/2006

Changes:

 Download v0.91 (tar.gz) - 11/04/2006

Changes:

 Download v0.90 (tar.gz) - 08/04/2006

Changes:

 Download v0.20 (tar.gz) - 07/04/2006

Changes:

 Download v0.19 (tar.gz) - 05/04/2006

Changes:

 Download v0.18 (tar.gz) - 02/04/2006

Changes:

 Download v0.17 (tar.gz) - 30/03/2006

Changes:

 Download v0.16 (tar.gz) - 24/03/2006

Changes:

 Download v0.15 (tar.gz) - 23/03/2006

Changes:

 Download v0.14 (tar.gz) - 20/03/2006

Changes:

 Download v0.13 (tar.gz) - 17/03/2006

Changes:

 Download v0.12 (tar.gz) - 16/11/2005

Changes:

 Download v0.11 (tar.gz) - 07/11/2005

Changes:

 Download v0.10 (tar.gz) - 02/11/2005

Changes:

 Download v0.9 (tar.gz) - 28/10/2005

Changes:

 Download v0.8 (tar.gz) - 26/10/2005

Changes:

 Download v0.7 (tar.gz) - 23/10/2005

Changes:

 Download v0.6 (tar.gz) - 24/09/2005

Changes:

 Download v0.5 (tar.gz) - 23/09/2005 (modified, first 0.5 has still buttons display problem, consider the first 0.5 as nuked ;)

Changes:

 Download v0.4 (tar.gz) - 22/09/2005

Changes:

 Download v0.3 (tar.gz) - 21/09/2005

Changes:

 Download v0.2 (tar.gz)

Changes:

 Download v0.1 (tar.gz)


 Contact : quentin.anciaux@advalvas.be