Package org.openpdf.text.pdf.internal
Class PdfVersionImp
java.lang.Object
org.openpdf.text.pdf.internal.PdfVersionImp
- All Implemented Interfaces:
PdfVersion
Stores the PDF version information, knows how to write a PDF Header, and how to add the version to the catalog (if
necessary).
For OpenPDF 3.0 this was updated to support PDF 2.0, and specifying PDF version using String "2.0" instead of char.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanIndicates if we are working in append mode.protected PdfNameThe version that will be written to the catalog.protected PdfDictionaryThe extensions dictionary.static final byte[][]Contains different strings that are part of the header.protected StringThe version that was or will be written to the header.protected booleanIndicates if the header was already written. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToCatalog(PdfDictionary catalog) Adds the version to the Catalog dictionary.byte[]getVersionAsByteArray(String version) Returns the version as a byte[].getVersionAsName(String version) Returns the PDF version as a name.voidWrites the header to the OutputStreamCounter.
-
Field Details
-
HEADER
public static final byte[][] HEADERContains different strings that are part of the header. -
headerWasWritten
protected boolean headerWasWrittenIndicates if the header was already written. -
appendmode
protected boolean appendmodeIndicates if we are working in append mode. -
header_version
The version that was or will be written to the header. -
catalog_version
The version that will be written to the catalog. -
extensions
The extensions dictionary.- Since:
- 2.1.6
-
-
Constructor Details
-
PdfVersionImp
public PdfVersionImp()
-
-
Method Details
-
writeHeader
Writes the header to the OutputStreamCounter.- Parameters:
os- the OutputStreamCounter- Throws:
IOException- thrown when an I/O operation goes wrong
-
getVersionAsName
Returns the PDF version as a name.- Parameters:
version- the version string.- Returns:
- a PdfName that contains the version
-
getVersionAsByteArray
Returns the version as a byte[].- Parameters:
version- the version string- Returns:
- a byte array containing the version according to the ISO-8859-1 codepage.
-
addToCatalog
Adds the version to the Catalog dictionary.- Parameters:
catalog- The PdfDictionary to add the version to
-