Class PdfVersionImp
java.lang.Object
com.aowagie.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).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanIndicates if we are working in append mode.private PdfNameThe version that will be written to the catalog.private PdfDictionaryThe extensions dictionary.private static final byte[][]Contains different strings that are part of the header.private charThe version that was or will be written to the header.private booleanIndicates if the header was already written. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a developer extension to the Extensions dictionary in the Catalog.voidaddToCatalog(PdfDictionary catalog) Adds the version to the Catalog dictionary.private byte[]getVersionAsByteArray(char version) Returns the version as a byte[].static PdfNamegetVersionAsName(char version) Returns the PDF version as a name.voidsetAppendmode(boolean appendmode) Sets the append mode.voidsetAtLeastPdfVersion(char version) If the PDF Header hasn't been written yet, this changes the version as it will appear in the PDF Header, but only if the parameter refers to a higher version.voidsetPdfVersion(char version) If the PDF Header hasn't been written yet, this changes the version as it will appear in the PDF Header.voidsetPdfVersion(PdfName version) Sets the PDF version as it will appear in the Catalog.voidWrites the header to the OutputStreamCounter.
-
Field Details
-
HEADER
private static final byte[][] HEADERContains different strings that are part of the header. -
headerWasWritten
private boolean headerWasWrittenIndicates if the header was already written. -
appendmode
private boolean appendmodeIndicates if we are working in append mode. -
header_version
private char header_versionThe version that was or will be written to the header. -
catalog_version
The version that will be written to the catalog. -
extensions
-
-
Constructor Details
-
PdfVersionImp
public PdfVersionImp()
-
-
Method Details
-
setPdfVersion
public void setPdfVersion(char version) Description copied from interface:PdfVersionIf the PDF Header hasn't been written yet, this changes the version as it will appear in the PDF Header. If the PDF header was already written to the OutputStream, this changes the version as it will appear in the Catalog.- Specified by:
setPdfVersionin interfacePdfVersion- Parameters:
version- a character representing the PDF version- See Also:
-
setAtLeastPdfVersion
public void setAtLeastPdfVersion(char version) Description copied from interface:PdfVersionIf the PDF Header hasn't been written yet, this changes the version as it will appear in the PDF Header, but only if the parameter refers to a higher version. If the PDF header was already written to the OutputStream, this changes the version as it will appear in the Catalog.- Specified by:
setAtLeastPdfVersionin interfacePdfVersion- Parameters:
version- a character representing the PDF version- See Also:
-
setPdfVersion
Description copied from interface:PdfVersionSets the PDF version as it will appear in the Catalog. Note that this only has effect if you use a later version than the one that appears in the header; this method ignores the parameter if you try to set a lower version.- Specified by:
setPdfVersionin interfacePdfVersion- Parameters:
version- the PDF name that will be used for the Version key in the catalog- See Also:
-
setAppendmode
public void setAppendmode(boolean appendmode) Sets the append mode.- Parameters:
appendmode- Append Mode.
-
writeHeader
Writes the header to the OutputStreamCounter.- Parameters:
os- OutputStream.- Throws:
IOException- I/O Exception.
-
getVersionAsName
Returns the PDF version as a name.- Parameters:
version- the version character.- Returns:
- Version name.
-
getVersionAsByteArray
private byte[] getVersionAsByteArray(char version) Returns the version as a byte[].- Parameters:
version- the version character- Returns:
- Version.
-
addToCatalog
Adds the version to the Catalog dictionary.- Parameters:
catalog- Catalog to set
-
addDeveloperExtension
Description copied from interface:PdfVersionAdds a developer extension to the Extensions dictionary in the Catalog.- Specified by:
addDeveloperExtensionin interfacePdfVersion- Parameters:
de- an object that contains the extensions prefix and dictionary- Since:
- 2.1.6
- See Also:
-