Class PdfWriter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceA PDF page size, expressed as a CSS@pagesize value.static enumThe page orientations, each mapped to its CSS@pageorientation keyword.static enumCommon page sizes, each mapped to its CSS@pagesize keyword.Nested classes/interfaces inherited from class com.northconcepts.datapipeline.core.DataEndpoint
DataEndpoint.State -
Field Summary
FieldsFields inherited from class com.northconcepts.datapipeline.core.DataEndpoint
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEYFields inherited from class com.northconcepts.datapipeline.core.Endpoint
captureElapsedTime, DEFAULT_READ_BUFFER_SIZEFields inherited from class com.northconcepts.datapipeline.core.DataObject
id, log, name, TIMESTAMP_FORMAT -
Constructor Summary
ConstructorsConstructorDescriptionCreates a writer for the file, which is created or truncated immediately; the PDF is rendered when the writer closes.PdfWriter(OutputStream outputStream) Creates a writer for the stream; the PDF is rendered to it, and the stream closed, when the writer closes. -
Method Summary
Modifier and TypeMethodDescriptionaddExceptionProperties(DataException exception) Adds this endpoint's current state to aDataException.voidclose()Indicates that this endpoint has finished reading or writing.Returns the custom CSS style applied to the PDF document (defaultnull).Returns the page orientation for the PDF document (defaultPdfWriter.PageOrientation.PORTRAIT).Returns the page size for the PDF document (defaultPdfWriter.PageSize.LETTER).voidopen()Makes this endpoint ready for reading or writing.setCustomStyle(String customStyle) Specifies a custom CSS style to be applied to the PDF document (defaultnull).setPageOrientation(PdfWriter.PageOrientation pageOrientation) Specifies the page orientation for the PDF document (defaultPdfWriter.PageOrientation.PORTRAIT).setPageSize(PdfWriter.IPageSize pageSize) Specifies the page size for the PDF document.setPageSize(String pageSize) Specifies the page size for the PDF document using a CSSpage/sizestring value.protected voidOverridden by subclasses to write the specified record to thisDataWriter.Methods inherited from class com.northconcepts.datapipeline.core.ProxyWriter
available, getNestedWriter, interceptRecord, map, map, setNestedDataWriter, setNestedDataWriterMethods inherited from class com.northconcepts.datapipeline.core.DataWriter
getNestedEndpoint, getRootEndpoint, getRootWriter, getWriter, writeMethods inherited from class com.northconcepts.datapipeline.core.DataEndpoint
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toStringMethods inherited from class com.northconcepts.datapipeline.core.Endpoint
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
-
Field Details
-
BUFFER_SIZE
public static final int BUFFER_SIZE- See Also:
-
-
Constructor Details
-
PdfWriter
Creates a writer for the file, which is created or truncated immediately; the PDF is rendered when the writer closes. -
PdfWriter
Creates a writer for the stream; the PDF is rendered to it, and the stream closed, when the writer closes.
-
-
Method Details
-
open
public void open()Description copied from class:DataEndpointMakes this endpoint ready for reading or writing.- Overrides:
openin classProxyWriter
-
close
public void close()Description copied from class:DataEndpointIndicates that this endpoint has finished reading or writing.- Overrides:
closein classProxyWriter
-
writeImpl
Description copied from class:DataWriterOverridden by subclasses to write the specified record to thisDataWriter.Contract for subclasses (see also
docs/authoring/DataWriter.md):- Do not call this method directly —
DataWriter.write(Record)is the template method that wraps exceptions, increments the record count, and attaches the offending record to thrownDataExceptions. - Do not call
DataEndpoint.incrementRecordCount()here;DataWriter.write(Record)already does. - Throw raw exceptions;
DataWriter.write(Record)wraps them viaexception(throwable).setRecord(record).
- Overrides:
writeImplin classProxyWriter- Throws:
Throwable
- Do not call this method directly —
-
getPageSize
Returns the page size for the PDF document (defaultPdfWriter.PageSize.LETTER). -
setPageSize
Specifies the page size for the PDF document.You can provide a predefined size using the
PdfWriter.PageSizeenum (e.g.,PdfWriter.PageSize.A4,PdfWriter.PageSize.LETTER), or you can create a customPdfWriter.IPageSizeimplementation for any valid CSSpage/sizevalue, such as10in 15in.The default page size is
PdfWriter.PageSize.LETTER.- See Also:
-
setPageSize
Specifies the page size for the PDF document using a CSSpage/sizestring value.This method allows you to define a custom page size using any valid CSS
page/sizestring, such as10in 15in.The default page size is
letter.- See Also:
-
getPageOrientation
Returns the page orientation for the PDF document (defaultPdfWriter.PageOrientation.PORTRAIT). -
setPageOrientation
Specifies the page orientation for the PDF document (defaultPdfWriter.PageOrientation.PORTRAIT). -
getCustomStyle
Returns the custom CSS style applied to the PDF document (defaultnull). -
setCustomStyle
Specifies a custom CSS style to be applied to the PDF document (defaultnull).This style will be included in the generated PDF and can be used to customize the appearance of the content, such as table styles, fonts, colors, etc.
You can provide a styling for the following HTML table structure:<!DOCTYPE html> <html lang='en-US' dir='ltr'> <head> </head> <body> <table> <thead> <tr> <th class='col-0'>Field1</th> <th class='col-1'>Field2</th> </tr> </thead> <tbody> <tr> <td class='col-0'>Value1</td> <td class='col-1'>Value2</td> </tr> </tbody> </table> </body> </html> -
addExceptionProperties
Description copied from class:EndpointAdds this endpoint's current state to aDataException. Since this method is called whenever an exception is thrown, subclasses should override it to add their specific information.- Overrides:
addExceptionPropertiesin classProxyWriter
-