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 InfoDictionarygetInfoDictionary()Return pdf document information dictionary representation.MetadatagetMetadata()Return pdf document metadata representation.booleanisNeedToBeUpdated()Implemented by GreenField library.intremoveFiltersForAllMetadataObjects()Removes filters for all metadata streams in documentMetadataFixerResultsaveDocumentIncremental(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- anInputStreamto 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:
getMetadatain 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:
getInfoDictionaryin interfacePDFDocument- Returns:
- information dictionary representation
- See Also:
InfoDictionary
-
isNeedToBeUpdated
public boolean isNeedToBeUpdated()
Implemented by GreenField library.- Specified by:
isNeedToBeUpdatedin 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. InMetadataFixerResultImplmust set 1 of 3 states:-
MetadataFixerResult.RepairStatus.FIX_ERRORif got problems with document save -
MetadataFixerResult.RepairStatus.NO_ACTIONif metadata and information dictionary was not changed -
MetadataFixerResult.RepairStatus.SUCCESSif document save successful
- Specified by:
saveDocumentIncrementalin interfacePDFDocumentoutput- output stream for document save- Returns:
-
-
removeFiltersForAllMetadataObjects
public int removeFiltersForAllMetadataObjects()
Description copied from interface:PDFDocumentRemoves filters for all metadata streams in document- Specified by:
removeFiltersForAllMetadataObjectsin interfacePDFDocument- Returns:
- number of unfiltered streams
-
-