Package com.openhtmltopdf.pdfboxout
Class PdfBoxRenderer
java.lang.Object
com.openhtmltopdf.pdfboxout.PdfBoxRenderer
- All Implemented Interfaces:
PageSupplier,Closeable,AutoCloseable
public class PdfBoxRenderer extends Object implements Closeable, PageSupplier
-
Method Summary
Modifier and Type Method Description voidcleanup()Deprecated.Use close instead.voidclose()Cleanup thread resources.voidcreatePDF()Creates a PDF with setup specified by builder.voidcreatePDF(OutputStream os)Deprecated.Use builder to set output stream.voidcreatePDF(OutputStream os, boolean finish)Deprecated.Use builder to set output stream.voidcreatePDF(OutputStream os, boolean finish, int initialPageNo)Deprecated.Use builder to set output stream.voidcreatePDFWithoutClosing()Creates a PDF with setup specified by builder.voidexportText(Writer writer)Deprecated.unused and untested.List<PagePosition>findPagePositionsByID(Pattern pattern)voidfinishPDF()Deprecated.DocumentgetDocument()floatgetDotsPerPoint()PdfBoxFontResolvergetFontResolver()Get the PDF-BOX font resolver.PDFCreationListenergetListener()PdfBoxOutputDevicegetOutputDevice()org.apache.pdfbox.pdmodel.PDDocumentgetPdfDocument()Returns the PDDocument or null if it has been closed.floatgetPDFVersion()com.openhtmltopdf.render.BlockBoxgetRootBox()com.openhtmltopdf.layout.SharedContextgetSharedContext()voidlayout()org.apache.pdfbox.pdmodel.PDPagerequestPage(org.apache.pdfbox.pdmodel.PDDocument doc, float pageWidth, float pageHeight, int pageNumber, int shadowPageNumber)Called whenever a page or shadow-page is needed.voidsetListener(PDFCreationListener listener)voidwriteNextDocument()Deprecated.Doubt this still works as untested.voidwriteNextDocument(int initialPageNo)Deprecated.Doubt this still works as untested.
-
Method Details
-
getDocument
-
getPdfDocument
public org.apache.pdfbox.pdmodel.PDDocument getPdfDocument()Returns the PDDocument or null if it has been closed. -
getFontResolver
Get the PDF-BOX font resolver. Can be used to add fonts in code.- Returns:
-
getPDFVersion
public float getPDFVersion() -
layout
public void layout() -
createPDF
Creates a PDF with setup specified by builder. On finsihing or failing, saves (if successful) and closes the PDF document.- Throws:
IOException
-
createPDFWithoutClosing
Creates a PDF with setup specified by builder. On finsihing or failing, DOES NOT save or close the PDF document. Useful for post-processing the PDDocument which can be retrieved by getPdfDocument().- Throws:
IOException
-
createPDF
Deprecated.Use builder to set output stream.- Parameters:
os-- Throws:
IOException
-
writeNextDocument
Deprecated.Doubt this still works as untested.- Throws:
IOException
-
writeNextDocument
Deprecated.Doubt this still works as untested.- Throws:
IOException
-
finishPDF
Deprecated.- Throws:
IOException
-
createPDF
Deprecated.Use builder to set output stream.- Throws:
IOException
-
createPDF
@Deprecated public void createPDF(OutputStream os, boolean finish, int initialPageNo) throws IOExceptionDeprecated.Use builder to set output stream. NOTE: Caller is responsible for cleaning up the OutputStream.- Throws:
IOException
-
getOutputDevice
-
exportText
Deprecated.unused and untested.- Parameters:
writer-- Throws:
IOException
-
getRootBox
public com.openhtmltopdf.render.BlockBox getRootBox() -
getDotsPerPoint
public float getDotsPerPoint() -
findPagePositionsByID
-
getListener
-
setListener
-
cleanup
Deprecated.Use close instead. -
close
public void close()Cleanup thread resources. MUST be called after finishing with the renderer.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
requestPage
public org.apache.pdfbox.pdmodel.PDPage requestPage(org.apache.pdfbox.pdmodel.PDDocument doc, float pageWidth, float pageHeight, int pageNumber, int shadowPageNumber)Description copied from interface:PageSupplierCalled whenever a page or shadow-page is needed.- Specified by:
requestPagein interfacePageSupplier- Parameters:
doc-PDDocumentthe page belongs topageWidth- Width of page in PDF points (1/72 inch)pageHeight- Height of page in PDF pointspageNumber- Number of the layout page - this may differ from the PDF document page if there are previous shadow pages.shadowPageNumber- Number of the shadow-page or -1 if on a main page.- Returns:
PDPage
-