Class PDFDocumentImpl
- java.lang.Object
-
- org.verapdf.metadata.fixer.gf.impl.model.PDFDocumentImpl
-
- All Implemented Interfaces:
PDFDocument
public class PDFDocumentImpl extends Object implements PDFDocument
- Author:
- Maksim Bezrukov
-
-
Constructor Summary
Constructors Constructor Description PDFDocumentImpl(InputStream pdfStream)
Create a new PDFDocumentImpl from the passed InputStreamPDFDocumentImpl(PDDocument document)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InfoDictionary
getInfoDictionary()
Return pdf document information dictionary representation.Metadata
getMetadata()
Return pdf document metadata representation.boolean
isNeedToBeUpdated()
Implemented by GreenField library.int
removeFiltersForAllMetadataObjects()
Removes filters for all metadata streams in documentMetadataFixerResult
saveDocumentIncremental(MetadataFixerResult.RepairStatus status, OutputStream output)
Incremental save of pdf document.
-
-
-
Constructor Detail
-
PDFDocumentImpl
public PDFDocumentImpl(InputStream pdfStream) throws IOException
Create a new PDFDocumentImpl from the passed InputStream- Parameters:
pdfStream
- anInputStream
to be parsed as a PDF Document.- Throws:
IOException
- when there's a problem reading or parsing the file.
-
PDFDocumentImpl
public PDFDocumentImpl(PDDocument document)
- Parameters:
document
-
-
-
Method Detail
-
getMetadata
public Metadata getMetadata()
Return pdf document metadata representation. Must return null if and only if handler having problems with metadata obtain (exceptions, for example). If metadata is not present in the document ('Metadata' key in catalog not present or empty) it`s must be added. Implemented by GreenField library.- Specified by:
getMetadata
in interfacePDFDocument
- Returns:
- metadata representation or null
- See Also:
Metadata
-
getInfoDictionary
public InfoDictionary getInfoDictionary()
Return pdf document information dictionary representation. Must be not null (empty, for example). Implemented by GreenField library.- Specified by:
getInfoDictionary
in interfacePDFDocument
- Returns:
- information dictionary representation
- See Also:
InfoDictionary
-
isNeedToBeUpdated
public boolean isNeedToBeUpdated()
Implemented by GreenField library.- Specified by:
isNeedToBeUpdated
in interfacePDFDocument
- Returns:
-
saveDocumentIncremental
public MetadataFixerResult saveDocumentIncremental(MetadataFixerResult.RepairStatus status, OutputStream output)
Incremental save of pdf document. Document must be saved if and only if metadata or information dictionary of document was changed. InMetadataFixerResultImpl
must set 1 of 3 states:-
MetadataFixerResult.RepairStatus.FIX_ERROR
if got problems with document save -
MetadataFixerResult.RepairStatus.NO_ACTION
if metadata and information dictionary was not changed -
MetadataFixerResult.RepairStatus.SUCCESS
if document save successful
- Specified by:
saveDocumentIncremental
in interfacePDFDocument
output
- output stream for document save- Returns:
-
-
removeFiltersForAllMetadataObjects
public int removeFiltersForAllMetadataObjects()
Description copied from interface:PDFDocument
Removes filters for all metadata streams in document- Specified by:
removeFiltersForAllMetadataObjects
in interfacePDFDocument
- Returns:
- number of unfiltered streams
-
-