org.allcolor.yahp.cl.converter
Class CHtmlToPdfFirefoxTransformer

java.lang.Object
  extended by org.allcolor.yahp.cl.converter.CHtmlToPdfFirefoxTransformer
All Implemented Interfaces:
IHtmlToPdfTransformer

public final class CHtmlToPdfFirefoxTransformer
extends java.lang.Object
implements IHtmlToPdfTransformer

This class transform an html document in a PDF.

Version:
0.94
Author:
Quentin Anciaux

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.allcolor.yahp.converter.IHtmlToPdfTransformer
IHtmlToPdfTransformer.CConvertException, IHtmlToPdfTransformer.CHeaderFooter, IHtmlToPdfTransformer.PageSize
 
Field Summary
 
Fields inherited from interface org.allcolor.yahp.converter.IHtmlToPdfTransformer
A0L, A0P, A10L, A10P, A11L, A11P, A12L, A12P, A13L, A13P, A14L, A14P, A1L, A1P, A2L, A2P, A3L, A3P, A4L, A4P, A5L, A5P, A6L, A6P, A7L, A7P, A8L, A8P, A9L, A9P, DEFAULT_PDF_RENDERER, FIREFOX_PDF_RENDERER, FIREFOX_PRINT_SCRIPT_PATH, FOP_TTF_FONT_PATH, HANDLE_CHAR_AS_GLYPH, OOO_PDF_HOST, OOO_PDF_PORT, OOO_PDF_RENDERER, PDF_ALLOW_ASSEMBLY, PDF_ALLOW_COPY, PDF_ALLOW_DEGRADED_PRINTING, PDF_ALLOW_FILLIN, PDF_ALLOW_MODIFT_ANNOTATIONS, PDF_ALLOW_MODIFY_CONTENTS, PDF_ALLOW_PRINTING, PDF_ALLOW_SCREEN_READERS, PDF_AUTHOR, PDF_CREATOR, PDF_ENCRYPTION_PASSWORD, PDF_PRODUCER, PDF_RENDERER_CLASS, PDF_SIGNING_KEYSTORE_PASSWORD, PDF_SIGNING_LOCATION, PDF_SIGNING_PRIVATE_KEY_FILE, PDF_SIGNING_PRIVATE_KEY_PASSWORD, PDF_SIGNING_REASON, PDF_TITLE, USE_PDF_ENCRYPTION, USE_PDF_SELF_SIGNING, USE_PDF_SIGNING, VERSION
 
Constructor Summary
CHtmlToPdfFirefoxTransformer()
          Creates a new CHtmlToPdfFirefoxTransformer object.
 
Method Summary
private  java.lang.String loadFile(java.io.InputStream in, java.lang.String urlForBase)
          Load the file from an inputstream
private  java.lang.String removeBaseIfPresent(java.lang.String fin)
          remove the base tag if present
 java.lang.String setCharset(java.lang.String fin)
          Set the Content-Type meta tag
 void transform(java.io.InputStream in, java.lang.String urlForBase, IHtmlToPdfTransformer.PageSize size, java.util.List hf, java.util.Map properties, java.io.OutputStream out)
          Transform the html document in the inputstream to a pdf in the outputstream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CHtmlToPdfFirefoxTransformer

public CHtmlToPdfFirefoxTransformer()
Creates a new CHtmlToPdfFirefoxTransformer object.

Method Detail

transform

public final void transform(java.io.InputStream in,
                            java.lang.String urlForBase,
                            IHtmlToPdfTransformer.PageSize size,
                            java.util.List hf,
                            java.util.Map properties,
                            java.io.OutputStream out)
                     throws IHtmlToPdfTransformer.CConvertException
Transform the html document in the inputstream to a pdf in the outputstream

Specified by:
transform in interface IHtmlToPdfTransformer
Parameters:
in - html document stream
urlForBase - base url of the document
size - pdf document page size
hf - header-footer list
properties - transform properties
out - out stream to the pdf file
Throws:
IHtmlToPdfTransformer.CConvertException - if a conversion exception occurs

loadFile

private java.lang.String loadFile(java.io.InputStream in,
                                  java.lang.String urlForBase)
                           throws java.io.IOException
Load the file from an inputstream

Parameters:
in - the stream to load
urlForBase - the base url of the document
Returns:
the content of the stream in a string
Throws:
java.io.IOException - if an error occurs

setCharset

public java.lang.String setCharset(java.lang.String fin)
Set the Content-Type meta tag

Parameters:
fin - content of the file
Returns:
content of the file + the meta tag set

removeBaseIfPresent

private java.lang.String removeBaseIfPresent(java.lang.String fin)
remove the base tag if present

Parameters:
fin - content of the file
Returns:
content of the file minus base tag