public class PdfWriter extends ProxyWriter
Modifier and Type | Class and Description |
---|---|
static interface |
PdfWriter.IPageSize |
static class |
PdfWriter.PageOrientation |
static class |
PdfWriter.PageSize |
DataEndpoint.State
Modifier and Type | Field and Description |
---|---|
static int |
BUFFER_SIZE |
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
PdfWriter(File file) |
PdfWriter(OutputStream outputStream) |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
void |
close()
Indicates that this endpoint has finished reading or writing.
|
String |
getCustomStyle()
Returns the custom CSS style applied to the PDF document (default
null ). |
PdfWriter.PageOrientation |
getPageOrientation()
Returns the page orientation for the PDF document (default
PdfWriter.PageOrientation.PORTRAIT ). |
PdfWriter.IPageSize |
getPageSize()
Returns the page size for the PDF document (default
PdfWriter.PageSize.LETTER ). |
void |
open()
Makes this endpoint ready for reading or writing.
|
PdfWriter |
setCustomStyle(String customStyle)
Specifies a custom CSS style to be applied to the PDF document (default
null ). |
PdfWriter |
setPageOrientation(PdfWriter.PageOrientation pageOrientation)
Specifies the page orientation for the PDF document (default
PdfWriter.PageOrientation.PORTRAIT ). |
PdfWriter |
setPageSize(PdfWriter.IPageSize pageSize)
Specifies the page size for the PDF document.
|
PdfWriter |
setPageSize(String pageSize)
Specifies the page size for the PDF document using a CSS
page/size string value. |
protected void |
writeImpl(Record record)
Overridden by subclasses to write the specified record to this
DataWriter . |
available, getNestedWriter, interceptRecord, map, map, setNestedDataWriter, setNestedDataWriter
getNestedEndpoint, getRootEndpoint, getRootWriter, getWriter, write
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
public static final int BUFFER_SIZE
public PdfWriter(File file)
public PdfWriter(OutputStream outputStream)
public void open()
DataEndpoint
open
in class ProxyWriter
public void close()
DataEndpoint
close
in class ProxyWriter
protected void writeImpl(Record record) throws Throwable
DataWriter
DataWriter
.writeImpl
in class ProxyWriter
Throwable
public PdfWriter.IPageSize getPageSize()
PdfWriter.PageSize.LETTER
).public PdfWriter setPageSize(PdfWriter.IPageSize pageSize)
You can provide a predefined size using the PdfWriter.PageSize
enum (e.g., PdfWriter.PageSize.A4
, PdfWriter.PageSize.LETTER
),
or you can create a custom PdfWriter.IPageSize
implementation for any valid
CSS page/size
value, such as 10in 15in
.
The default page size is PdfWriter.PageSize.LETTER
.
public PdfWriter setPageSize(String pageSize)
page/size
string value.
This method allows you to define a custom page size using any valid CSS page/size
string, such as 10in 15in
.
The default page size is letter
.
public PdfWriter.PageOrientation getPageOrientation()
PdfWriter.PageOrientation.PORTRAIT
).public PdfWriter setPageOrientation(PdfWriter.PageOrientation pageOrientation)
PdfWriter.PageOrientation.PORTRAIT
).public String getCustomStyle()
null
).public PdfWriter setCustomStyle(String customStyle)
null
).
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>
public DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class ProxyWriter
Copyright (c) 2006-2025 North Concepts Inc. All Rights Reserved.