java.lang.Object | |
↳ | com.pdftron.pdf.ElementWriter |
ElementWriter can be used to assemble and write new content to a page, Form XObject, Type3 Glyph stream, pattern stream, or any other content stream.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | e_overlay | The Constant e_overlay. | |||||||||
int | e_replacement | The Constant e_replacement. | |||||||||
int | e_underlay | Enumeration describing the placement of the element written to a page. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
ElementWriter()
Instantiates a new element writer.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void |
begin(Page page, int write_mode, boolean page_coord_sys)
Begin writing to the given page.
| ||||||||||
void |
begin(Doc doc)
Begin writing an Element sequence to a new stream.
| ||||||||||
void |
begin(Obj streamobj_to_update)
Begin writing an Element sequence to a stream.
| ||||||||||
void |
begin(Page page)
Begin writing to the given page.
| ||||||||||
void |
begin(Page page, int write_mode)
Begin writing to the given page.
| ||||||||||
void |
begin(Obj streamobj_to_update, boolean compress)
Begin writing an Element sequence to a stream.
| ||||||||||
void |
begin(Page page, int write_mode, boolean page_coord_sys, boolean compress)
Begin writing to the given page.
| ||||||||||
void |
begin(Obj streamobj_to_update, boolean compress, Obj resources)
Begin writing an Element sequence to a stream.
| ||||||||||
void |
begin(Page page, int write_mode, boolean page_coord_sys, boolean compress, Obj resources)
Begin writing to the given page.
| ||||||||||
void |
begin(Doc doc, boolean compress)
Begin writing an Element sequence to a new stream.
| ||||||||||
void |
close()
Frees the native memory of the object.
| ||||||||||
void |
destroy()
Frees the native memory of the object.
| ||||||||||
Obj |
end()
Finish writing to a page.
| ||||||||||
void |
flush()
The Flush method flushes all pending Element writing operations.
| ||||||||||
void |
setDefaultGState(ElementReader reader)
Initializes ElementWriter state with the state of a given ElementReader.
| ||||||||||
void |
writeBuffer(byte[] data)
Writes an arbitrary buffer to the content stream.
| ||||||||||
void |
writeElement(Element element)
Writes the Element to the content stream.
| ||||||||||
void |
writeGStateChanges(Element element)
Write only the graphics state changes applied to this element and skip writing the element itself.
| ||||||||||
void |
writePlacedElement(Element element)
A utility function that surrounds the given Element with a graphics state
Save/Restore Element (i.e.
| ||||||||||
void |
writeString(String str)
Writes an arbitrary string to the content stream.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
From interface
com.pdftron.pdf.__Delete
| |||||||||||
From interface
java.lang.AutoCloseable
|
The Constant e_overlay.
The Constant e_replacement.
Enumeration describing the placement of the element written to a page.
Begin writing to the given page.
page | The page to write content. |
---|---|
write_mode | the write mode |
page_coord_sys | An optional flag used to select the target coordinate system if true (default), the coordinates are relative to the lower-left corner of the page, otherwise the coordinates are defined in PDF user coordinate system (which may, or may not coincide with the page coordinates). |
PDFNetException |
---|
Begin writing an Element sequence to a new stream. Use this function to write Elements to a content stream other than the page. For example, you can create Form XObjects (See Section '4.9 Form XObjects' in PDF Reference for more details) pattern streams, Type3 font glyph streams, etc.
Note: the newly created content stream object is returned when writing operations are completed (i.e. after the call to ElementWriter::End()).
doc | - A low-level SDF/Cos document that will contain the new stream. You can access low-level document using PDFDoc::GetSDFDoc() or Obj::GetDoc() methods. |
---|
PDFNetException |
---|
Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter.
streamobj_to_update | A low-level SDF stream object that will contain the new stream. Old stream inside that object will be discarded. |
---|
PDFNetException |
---|
Begin writing to the given page. By default, new content will be appended to the page, as foreground graphics.
page | The page to write content. |
---|
PDFNetException |
---|
Begin writing to the given page.
page | The page to write content. |
---|---|
write_mode | the write mode |
PDFNetException |
---|
Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter.
streamobj_to_update | A low-level SDF stream object that will contain the new stream. Old stream inside that object will be discarded. |
---|---|
compress | whether the content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF file |
PDFNetException |
---|
Begin writing to the given page.
page | The page to write content. |
---|---|
write_mode | the write mode |
page_coord_sys | An optional flag used to select the target coordinate system if true (default), the coordinates are relative to the lower-left corner of the page, otherwise the coordinates are defined in PDF user coordinate system (which may, or may not coincide with the page coordinates). |
compress | whether the page content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. |
PDFNetException |
---|
Begin writing an Element sequence to a stream. Use this function to write Elements to a content stream which will replace an existing content stream in an object passed as a parameter.
streamobj_to_update | A low-level SDF stream object that will contain the new stream. Old stream inside that object will be discarded. |
---|---|
compress | whether the content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF file |
resources | the resource dictionary in which to store resources for the final page. By default, a new resource dictionary will be created. |
PDFNetException |
---|
Begin writing to the given page.
page | The page to write content. |
---|---|
write_mode | the write mode |
page_coord_sys | An optional flag used to select the target coordinate system if true (default), the coordinates are relative to the lower-left corner of the page, otherwise the coordinates are defined in PDF user coordinate system (which may, or may not coincide with the page coordinates). |
compress | whether the page content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. By default, all content streams are compressed. |
resources | the resource dictionary in which to store resources for the final page. By default, a new resource dictionary will be created. |
PDFNetException |
---|
Begin writing an Element sequence to a new stream.
doc | the document that will contain the new stream. |
---|---|
compress | whether the page content stream should be compressed. This may be useful for debugging content streams. Also some applications need to do a clear text search on strings in the PDF files. |
PDFNetException |
---|
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
PDFNetException |
---|
Frees the native memory of the object. This can be explicity called to control the deallocation of native memory and avoid situations where the garbage collector does not free the object in a timely manner.
PDFNetException |
---|
Finish writing to a page.
PDFNetException |
---|
The Flush method flushes all pending Element writing operations. This method is typically only required to be called when intermixing direct content writing (i.e. WriteBuffer/WriteString) with Element writing.
PDFNetException |
---|
Initializes ElementWriter state with the state of a given ElementReader. This can be used to avoid incorrectly writing inherited GState attributes.
reader | the ElementReader |
---|
PDFNetException |
---|
Writes an arbitrary buffer to the content stream. This function can be used to insert comments, inline-image data, and chunks of arbitrary content to the output stream.
data | the data |
---|
PDFNetException |
---|
Writes the Element to the content stream.
element | the element to be written to the content stream |
---|
PDFNetException |
---|
Write only the graphics state changes applied to this element and skip writing the element itself. This is especially useful when rewriting page content, but with the intention to skip certain elements.
element | The element for which to write graphics state changes. |
---|
PDFNetException |
---|
A utility function that surrounds the given Element with a graphics state Save/Restore Element (i.e. in PDF content stream represented as 'q element Q'). The function is equivalent to calling WriteElement three times: WriteElement(eSave); WriteElement(element); WriteElement(eRestore); where eSave is 'e_group_begin' and eRestore is 'e_group_end' Element The function is useful when XObjects such as Images and Forms are drawn on the page.
element | the element |
---|
PDFNetException |
---|
Writes an arbitrary string to the content stream. Serves the same purpose as WriteBuffer().
str | the str |
---|
PDFNetException |
---|