Package com.itextpdf.text.pdf.internal
Class PdfVersionImp
java.lang.Object
com.itextpdf.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 TypeFieldDescriptionprotected boolean
Indicates if we are working in append mode.protected PdfName
The version that will be written to the catalog.protected PdfDictionary
The extensions dictionary.static final byte[][]
Contains different strings that are part of the header.protected char
The version that was or will be written to the header.protected boolean
Indicates if the header was already written.protected char
The version that user can use to get the actual version of PDF document -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a developer extension to the Extensions dictionary in the Catalog.void
addToCatalog
(PdfDictionary catalog) Adds the version to the Catalog dictionary.char
byte[]
getVersionAsByteArray
(char version) Returns the version as a byte[].getVersionAsName
(char version) Returns the PDF version as a name.void
setAppendmode
(boolean appendmode) Sets the append mode.void
setAtLeastPdfVersion
(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.void
setPdfVersion
(char version) If the PDF Header hasn't been written yet, this changes the version as it will appear in the PDF Header.void
setPdfVersion
(PdfName version) Sets the PDF version as it will appear in the Catalog.void
Writes 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
protected char header_versionThe version that was or will be written to the header. -
catalog_version
The version that will be written to the catalog. -
version
protected char versionThe version that user can use to get the actual version of PDF document -
extensions
The extensions dictionary.- Since:
- 2.1.6
-
-
Constructor Details
-
PdfVersionImp
public PdfVersionImp()
-
-
Method Details
-
setPdfVersion
public void setPdfVersion(char version) Description copied from interface:PdfVersion
If 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:
setPdfVersion
in interfacePdfVersion
- Parameters:
version
- a character representing the PDF version- See Also:
-
setAtLeastPdfVersion
public void setAtLeastPdfVersion(char version) Description copied from interface:PdfVersion
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. If the PDF header was already written to the OutputStream, this changes the version as it will appear in the Catalog.- Specified by:
setAtLeastPdfVersion
in interfacePdfVersion
- Parameters:
version
- a character representing the PDF version- See Also:
-
setPdfVersion
Description copied from interface:PdfVersion
Sets 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 than the one currently set in the Catalog.- Specified by:
setPdfVersion
in 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. -
writeHeader
Writes the header to the OutputStreamCounter.- Throws:
IOException
-
getVersionAsName
Returns the PDF version as a name.- Parameters:
version
- the version character.
-
getVersionAsByteArray
public byte[] getVersionAsByteArray(char version) Returns the version as a byte[].- Parameters:
version
- the version character
-
addToCatalog
Adds the version to the Catalog dictionary. -
addDeveloperExtension
Description copied from interface:PdfVersion
Adds a developer extension to the Extensions dictionary in the Catalog.- Specified by:
addDeveloperExtension
in interfacePdfVersion
- Parameters:
de
- an object that contains the extensions prefix and dictionary- Since:
- 2.1.6
- See Also:
-
getVersion
public char getVersion()
-