Class PdfArlingtonValidator
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordThe result of fixing a single PDF file.static final recordThe result of validating a single PDF file. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPdfArlingtonValidator(Map<String, org.jpedal.arlington.model.ArlingtonObject> model, org.jpedal.io.writer.PdfFile info, org.jpedal.io.writer.PdfBuffer buffer, float pdfVersion) Create a new instance of the validator. -
Method Summary
Modifier and TypeMethodDescriptionfixFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain.fixFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.fixFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain.fixFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.fixFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain.fixFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.fixFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain.fixFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.fixFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain.fixFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.fixFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain.fixFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) Fix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.Returns the extensions currently assumed to be implemented by the PDF being validated.List<org.jpedal.arlington.validate.AppliedFix> getFixes()Returns all changes made to the document so far.Returns all issues collected so far.static intReturns the current threshold for which fixed documents are written to disk rather than being stored in memory.static voidEntry point that validates one or more PDF files against the Arlington Model.static voidsetMemoryCacheThreshold(int memoryCacheThreshold) Set the threshold at which fixed documents created byfixFile(File, byte[], Map, Set, File)which exceed this size will be written to the disk (encrypted withCryptoIDR) rather than stored in memory.static PdfArlingtonValidator.ResultvalidateFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) Validate a single PDF file against the Arlington model, assuming a given set of Arlington extensions are implemented.static PdfArlingtonValidator.ResultvalidateFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) Validate a single PDF file against the Arlington model, assuming a given set of Arlington extensions are implemented.static PdfArlingtonValidator.ResultvalidateFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) Validate a single PDF file against the Arlington model.static PdfArlingtonValidator.ResultvalidateFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) Validate a single PDF file against the Arlington model.voidvalidateFile(org.jpedal.io.writer.PdfFile pdf) Validate an entire file (starting from the trailer) against a TSV definition.voidvalidateObject(org.jpedal.io.writer.PdfObjectInt obj, String arlingtonObjectName, String path) Validate an arbitrary resolved object against a TSV definition.withExtensions(Set<String> extensionNames) Specify which extensions should be assumed to be implemented by the PDF being validated.withFixes(boolean fix) Specify whether violations should be fixed in the loaded document instead of being reported.
-
Field Details
-
VALID_DATE
Regex to validate PDF date strings. See 7.9.4 Dates.Each field after the year may only be present if all of the fields before it are. In the time zone, the apostrophe after the hour offset and the minute offset are optional, and so is the apostrophe after the minute offset (it was required before PDF 2.0).
Note that this does not support language escape sequences!
-
-
Constructor Details
-
PdfArlingtonValidator
public PdfArlingtonValidator(Map<String, org.jpedal.arlington.model.ArlingtonObject> model, org.jpedal.io.writer.PdfFile info, org.jpedal.io.writer.PdfBuffer buffer, float pdfVersion) Create a new instance of the validator.- Parameters:
model- the Arlington Model to validate againstinfo- the currently loaded PDFbuffer- the buffer object for the currently loaded PDFpdfVersion- the currently loaded PDF version
-
-
Method Details
-
withExtensions
Specify which extensions should be assumed to be implemented by the PDF being validated.- Parameters:
extensionNames- the names of the extensions to assume are implemented or null- Returns:
- itself
-
getExtensions
Returns the extensions currently assumed to be implemented by the PDF being validated.- Returns:
- the extensions currently assumed to be implemented by the PDF being validated
- See Also:
-
withFixes
Specify whether violations should be fixed in the loaded document instead of being reported.When enabled:
- a missing required key or array element is added with its Arlington default value, if it has a plain literal default;
- an optional dictionary key with an invalid value (wrong type, not a permitted value or failing its special case) is removed;
- an optional dictionary key whose value is an empty array, where the array must have at least one element (e.g. an empty /AF), is removed;
- a direct object which must be indirect is moved to a new indirect object.
PdfFilepassed to the constructor and are listed bygetFixes().Name and number trees with entries and the keys which say how a stream is encoded are never removed, as removing them would lose content. A dictionary whose /Type, /Subtype, /S or /FT is not permitted by the definition it is being checked against, but is by another definition it fits at least as well, is not fixed. Changes are kept by updating the indirect objects holding them, so when using
validateObject(PdfObjectInt, String, String)with fixing, the object should be the trailer or a direct object: changes to an indirect object passed to it are made to that copy only.- Parameters:
fix- true to fix violations- Returns:
- itself
- See Also:
-
setMemoryCacheThreshold
public static void setMemoryCacheThreshold(int memoryCacheThreshold) Set the threshold at which fixed documents created byfixFile(File, byte[], Map, Set, File)which exceed this size will be written to the disk (encrypted withCryptoIDR) rather than stored in memory.Default:
58MB- Parameters:
memoryCacheThreshold- the threshold- See Also:
-
getMemoryCacheThreshold
public static int getMemoryCacheThreshold()Returns the current threshold for which fixed documents are written to disk rather than being stored in memory.- Returns:
- the current threshold for which fixed documents are written to disk rather than being stored in memory
- See Also:
-
getIssues
Returns all issues collected so far.- Returns:
- all issues collected so far
-
getFixes
Returns all changes made to the document so far.- Returns:
- all changes made to the document so far
- See Also:
-
validateFile
Validate an entire file (starting from the trailer) against a TSV definition.- Parameters:
pdf- the file to validate- Throws:
IOException- if the underlying PDF cannot be read
-
validateObject
public void validateObject(org.jpedal.io.writer.PdfObjectInt obj, String arlingtonObjectName, String path) throws IOException Validate an arbitrary resolved object against a TSV definition.- Parameters:
obj- the resolved object to checkarlingtonObjectName- the Arlington TSV name to validate againstpath- a human readable path label- Throws:
IOException- if the underlying PDF cannot be read
-
main
Entry point that validates one or more PDF files against the Arlington Model.Usage:
java org.jpedal.arlington.validate.PdfArlingtonValidator --tsv <path-to-arlington-tsv-dir> [--level LEVEL] [--fix OUTPUT_DIR] file1.pdf [file2.pdf ...]- Throws:
IOException
-
validateFile
public static PdfArlingtonValidator.Result validateFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file on diskmodel- the loaded Arlington model- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all
-
validateFile
public static PdfArlingtonValidator.Result validateFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file on diskpassword- the password for the file, or null if it does not have onemodel- the loaded Arlington model- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all
-
validateFile
public static PdfArlingtonValidator.Result validateFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) throws IOExceptionValidate a single PDF file against the Arlington model, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file on diskmodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or null- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all- See Also:
-
validateFile
public static PdfArlingtonValidator.Result validateFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) throws IOExceptionValidate a single PDF file against the Arlington model, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file on diskpassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or null- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all- See Also:
-
validateFile
public static PdfArlingtonValidator.Result validateFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file as a byte arraymodel- the loaded Arlington model- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all
-
validateFile
public static PdfArlingtonValidator.Result validateFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file as a byte arraypassword- the password for the file, or null if it does not have onemodel- the loaded Arlington model- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all
-
validateFile
public static PdfArlingtonValidator.Result validateFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file as a byte arraymodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or null- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all
-
validateFile
public static PdfArlingtonValidator.Result validateFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file as a byte arraypassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or null- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all
-
validateFile
public static PdfArlingtonValidator.Result validateFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file on diskmodel- the loaded Arlington model- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
validateFile
public static PdfArlingtonValidator.Result validateFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file from an InputStreampassword- the password for the file, or null if it does not have onemodel- the loaded Arlington model- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
validateFile
public static PdfArlingtonValidator.Result validateFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file on diskmodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or null- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
validateFile
public static PdfArlingtonValidator.Result validateFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions) throws IOExceptionValidate a single PDF file against the Arlington model.- Parameters:
pdfFile- the PDF file from an InputStreampassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or null- Returns:
- the validation result (PDF version detected plus all issues found)
- Throws:
IOException- if the PDF cannot be opened/parsed at all- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain.- Parameters:
pdfFile- the PDF file on diskmodel- the loaded Arlington modeloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(File pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file on diskmodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or nulloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain.- Parameters:
pdfFile- the PDF file on diskpassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modeloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, it is encrypted, oroutputFileispdfFile- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(File pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.See
withFixes(boolean)for what is fixed. The fixed document is written and validated again, and is only written tooutputFilewhen that finds noValidationIssue.Severity.ERRORs. The file is rewritten even if nothing needed fixing.The fixed document is held in memory, unless it is larger than
getMemoryCacheThreshold(), when it is written to a temporary file in the directory ofoutputFileencrypted withCryptoIDR.- Parameters:
pdfFile- the PDF file on diskpassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or nulloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, it is encrypted, oroutputFileispdfFile
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain.- Parameters:
pdfFile- the PDF file as a byte arraymodel- the loaded Arlington modeloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(byte[] pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file as a byte arraymodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or nulloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain.- Parameters:
pdfFile- the PDF file as a byte arraypassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modeloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(byte[] pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file as a byte arraypassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or nulloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain.- Parameters:
pdfFile- the PDF file from an InputStreammodel- the loaded Arlington modeloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(InputStream pdfFile, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file from an InputStreammodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or nulloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain.- Parameters:
pdfFile- the PDF file from an InputStreampassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modeloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-
fixFile
public static PdfArlingtonValidator.FixResult fixFile(InputStream pdfFile, byte[] password, Map<String, org.jpedal.arlington.model.ArlingtonObject> model, Set<String> extensions, File outputFile) throws IOExceptionFix a single PDF file against the Arlington model and write the fixed file if no errors remain, assuming a given set of Arlington extensions are implemented.- Parameters:
pdfFile- the PDF file from an InputStreampassword- the password for the file, or null if it does not have onemodel- the loaded Arlington modelextensions- the Arlington extensions to assume are implemented or nulloutputFile- where to write the fixed file- Returns:
- the changes made, the issues found in the fixed file and whether it was written
- Throws:
IOException- if the PDF cannot be opened/parsed/written, or it is encrypted- See Also:
- API Note:
- PDF files must allow for random access, so the InputStream is read fully then cached to disk. The file is encrypted at rest and deleted once close is called.
-