Loading...
Searching...
No Matches
PDFACompliance.h
Go to the documentation of this file.
1//---------------------------------------------------------------------------------------
2// Copyright (c) 2001-2025 by Apryse Software Inc. All Rights Reserved.
3// Consult legal.txt regarding legal and license information.
4//---------------------------------------------------------------------------------------
5#ifndef PDFTRON_H_CPPPDFPDFAPDFACompliance
6#define PDFTRON_H_CPPPDFPDFAPDFACompliance
7
8#include <vector>
9#include <PDF/PDFDoc.h>
10#include <C/PDF/PDFA/TRN_PDFACompliance.h>
11#include <Common/UString.h>
12
13
14namespace pdftron {
15 namespace PDF {
16 namespace PDFA {
17 class PDFAOptions;
18
53{
54public:
55
83
85 {
86 // PDF/A-1 Level B Validation Errors --------------------------------
258
259 // PDF/A-1 Level A Validation Errors --------------------------------
266
267
268 // PDF/A-2 Level B Validation Errors --------------------------------
305 e_PDFA6_9_1 =69001,
306 e_PDFA6_9_3 =69003,
307
308 // PDF/A-3 Validation Errors --------------------------------------
313
314 // PDF/A-4 Validation Errors --------------------------------------
331
333 };
334
335
350 PDFACompliance(bool convert, const UString& file_path, const char* password = 0, Conformance conf = e_Level1B, ErrorCode* exceptions = 0, int num_exceptions = 0, int max_ref_objs = 10, bool first_stop = false);
351
368 PDFACompliance(bool convert, const char* buf, size_t buf_size, const char* password = 0, Conformance conf = e_Level1B, ErrorCode* exceptions = 0, int num_exceptions = 0, int max_ref_objs = 10, bool first_stop = false);
369 PDFACompliance(bool convert, const unsigned char* buf, size_t buf_size, const char* password = 0, Conformance conf = e_Level1B, ErrorCode* exceptions = 0, int num_exceptions = 0, int max_ref_objs = 10, bool first_stop = false);
370
382 PDFACompliance(bool convert, const UString& file_path, const PDFA::PDFAOptions& in_options);
383
397 PDFACompliance(bool convert, const char* buf, size_t buf_size, const PDFA::PDFAOptions& in_options);
398 PDFACompliance(bool convert, const unsigned char* buf, size_t buf_size, const PDFA::PDFAOptions& in_options);
399
408 void SaveAs(const UString& file_path, bool linearized = false);
409
418 std::vector<unsigned char> SaveAs(bool linearized = false);
419
420#ifndef SWIG
432 void SaveAs(const char* &out_buf, size_t& out_buf_size, bool linearized = false);
433#endif
434
439
448
454
466 size_t GetRefObj(ErrorCode id, size_t err_idx);
467
472 static const char* GetPDFAErrorMessage(ErrorCode id);
473
480
485
489 void Destroy();
490
491#ifndef SWIGHIDDEN
492 PDFACompliance(TRN_PDFACompliance impl) : mp_pdfac(impl) {}
493 TRN_PDFACompliance mp_pdfac;
494#endif
495private:
497 PDFACompliance& operator= (const PDFACompliance&);
498};
499
500
501 }; // namespace PDFA
502 }; // namespace PDF
503}; // namespace pdftron
504
505#include <Impl/PDFACompliance.inl>
506
507#endif // PDFTRON_H_CPPPDFPDFAPDFACompliance
void SaveAs(const char *&out_buf, size_t &out_buf_size, bool linearized=false)
PDFACompliance(bool convert, const unsigned char *buf, size_t buf_size, const char *password=0, Conformance conf=e_Level1B, ErrorCode *exceptions=0, int num_exceptions=0, int max_ref_objs=10, bool first_stop=false)
static const char * GetPDFAErrorMessage(ErrorCode id)
PDFACompliance(bool convert, const unsigned char *buf, size_t buf_size, const PDFA::PDFAOptions &in_options)
PDFACompliance(TRN_PDFACompliance impl)
size_t GetRefObjCount(ErrorCode id)
PDFACompliance(bool convert, const char *buf, size_t buf_size, const PDFA::PDFAOptions &in_options)
static PDFACompliance::Conformance GetDeclaredConformance(const PDF::PDFDoc &in_doc)
PDFACompliance(bool convert, const UString &file_path, const PDFA::PDFAOptions &in_options)
PDFACompliance(bool convert, const UString &file_path, const char *password=0, Conformance conf=e_Level1B, ErrorCode *exceptions=0, int num_exceptions=0, int max_ref_objs=10, bool first_stop=false)
size_t GetRefObj(ErrorCode id, size_t err_idx)
PDFACompliance(bool convert, const char *buf, size_t buf_size, const char *password=0, Conformance conf=e_Level1B, ErrorCode *exceptions=0, int num_exceptions=0, int max_ref_objs=10, bool first_stop=false)
PDFACompliance::ErrorCode GetError(size_t idx)
std::vector< unsigned char > SaveAs(bool linearized=false)
void SaveAs(const UString &file_path, bool linearized=false)
@ e_PDFA_4_6_2_2_3
A content stream's named resource not defined by a resource dictionary.
@ e_PDFA0_1_4
Contains compressed object streams (PDF 1.4 compatibility).
@ e_PDFA5_2_4
Movie annotation is not permitted.
@ e_PDFA6_2_11_3_3
A CMap references another non-standard CMap.
@ e_PDFA8_3_4_1
A non-standard structure type does not map to a standard type.
@ e_PDFA2_8_3_4
JPEG2000: The bit-depth JPEG2000 data must be in range 1-38.
@ e_PDFA7_2_3
The XMP Metadata stream is not valid.
@ e_PDFA7_8_11
The required namespace prefix for extension schema is 'pdfaExtension'.
@ e_PDFA5_3_2_3
An annotation's 'Hidden' flag is set.
@ e_PDFA7_2_2
The Metadata object stream contains Filter key.
@ e_PDFA1_12_13
Maximum number of DeviceN components (8) exceeded.
@ e_PDFA1_4_1
Subsection header: starting object number and range not separated by a single space.
@ e_PDFA5_2_3
Sound annotation is not permitted.
@ e_PDFA1_8_6
'endobj' not followed by EOL marker
@ e_PDFA1_6_1
Invalid hexadecimal strings used.
@ e_PDFA1_12_7
Real number's integer part has excessive absolute magnitude; it must be 32767.0 or less.
@ e_PDFA7_8_2
XMP Extension schema is not valid. Required property 'namespaceURI' might be missing in PDF/A Schema ...
@ e_PDFA2_8_3_1
JPEG2000: Only the JPX baseline is supported.
@ e_PDFA5_2_5
Redact annotation is not permitted.
@ e_PDFA8_3_3_1
Missing StructTreeRoot.
@ e_PDFA1_12_8
A conforming file shall not contain any real number closer to zero than +/- 1.175 x 10^-38.
@ e_PDFA6_2_11_7
PUA characters are missing ActualText.
@ e_PDFA3_2_6
A non-standard simple font dictionary has missing or invalid LastChar entry.
@ e_PDFA2_8_3_3
JPEG2000: Invalid color space.
@ e_PDFA6_9_3
Optional content Contains AS entry.
@ e_PDFA_4_6_2_10_6_4
Symbolic TrueType fonts shall not contain an Encoding entry in the font dictionary,...
@ e_PDFA5_3_4_2
An annotation AP dictionary does not contain N entry.
@ e_PDFA_3E2
Embedded file has no AFRelationship.
@ e_PDFA_4_6_9_5
Doc catalog is missing EmbeddedFiles key.
@ e_PDFA5_3_2_5
An annotation's 'NoView' flag is set.
@ e_PDFA9_5
A Widget annotation does not have an appearance dictionary.
@ e_PDFA2_8_3_5
JPEG2000: All colour channels in the JPEG2000 data must have the same bit-depth.
@ e_PDFA1_12_15
Maximum value (65535) of a CID (character identifier) exceeded.
@ e_PDFA1_11_1
A file specification dictionary contains a non-compliant embedded file (EF key).
@ e_PDFA7_8_31
A property doesn't match its custom schema type.
@ e_PDFA_3E3
Doc catalog is missing AF entry.
@ e_PDFA8_1
FileSpec is missing F or UF key.
@ e_PDFA7_5_1
'bytes' and 'encoding' attributes are not allowed in the header of an XMP packet.
@ e_PDFA2_8_1
Contains an invalid Transfer Curve in the extended graphics state.
@ e_PDFA3_3_4
Annotation which has non-zero width and height and is not a popup or link does not have an appearance...
@ e_PDFA6_2_2
Contains the JavaScript key.
@ e_PDFA7_3_2
Document information entry 'Author' not synchronized with XMP.
@ e_PDFA7_8_10
'pdfaProperty:valueType' not found.
@ e_PDFA7_8_15
The required field namespace prefix is 'pdfaField'.
@ e_PDFA7_8_18
Required property 'valueType' missing in PDF/A Schema Value Type.
@ e_PDFA1_11_2
Contains the EmbeddedFiles key.
@ e_PDFA3_2_3
A Font dictionary has missing or invalid Subtype entry.
@ e_PDFA1_13_5
Page dimensions are outside of the allowed range (3-14400).
@ e_PDFA7_3_3
Document information entry 'Subject' not synchronized with XMP.
@ e_PDFA2_7_1
Contains an XObject that is not supported (e.g. PostScript XObject).
@ e_PDFA1_12_4
Contains an integer value outside of the allowed range [-2^31, 2^31-1],.
@ e_PDFA_4_6_1_3_5
If a document information dictionary is present, it shall only contain a ModDate entry.
@ e_PDFA5_2_6
3D annotation is not permitted.
@ e_PDFA5_3_1
An annotation dictionary contains the CA key with a value other than 1.0.
@ e_PDFA9_1
An interactive form field contains an action.
@ e_PDFA3_6_1
Widths in embedded font are inconsistent with /Widths entry in the font dictionary.
@ e_PDFA7_11_4
Invalid PDF/A part number.
@ e_PDFA7_8_9
A description for a property is missing in 'pdfaSchema:property' sequence.
@ e_PDFA7_11_2
Invalid PDF/A identifier namespace.
@ e_PDFA5_2_8
Watermark annotation is not permitted.
@ e_PDFA1_3_3
Data after last EOF marker.
@ e_PDFA1_7_2
The 'endstream' token is not preceded by EOL.
@ e_PDFA3_5_3
Embedded TrueType font program does not define all font glyphs.
@ e_PDFA_3E1
Embedded file has no MIME type entry.
@ e_PDFA7_8_24
'pdfaField:name' not found.
@ e_PDFA6_2_11_5
Some characters map to 0, FEFF or FFFE.
@ e_PDFA7_8_20
'pdfaType:type' is using a wrong value type.
@ e_PDFA1_2_2
File header line not followed by % and 4 characters > 127.
@ e_PDFA1_7_1
The 'stream' token is not followed by CR and LF or a single LF.
@ e_PDFA_4_6_2_5_3
HTO entry in ExtGState.
@ e_PDFA1_12_11
Maximum length of a string in bytes (65535) exceeded.
@ e_PDFA7_8_7
'pdfaProperty:name' not found.
@ e_PDFA3_4_1
The font program is not embedded.
@ e_PDFA6_2_11_6
Some text can't be mapped to Unicode.
@ e_PDFA6_2_1
The document catalog dictionary contains AA entry.
@ e_PDFA1_3_1
The trailer dictionary does not contain ID.
@ e_PDFA1_8_4
'endobj' not preceded by EOL marker
@ e_PDFA_4_6_1_12_1
If the Version key is present in the document catalog dictionary, the first character in its value sh...
@ e_PDFA1_3_5
The file trailer dictionary's ID values are empty.
@ e_PDFA7_8_1
XMP Extension schema doesn't have a description.
@ e_PDFA1_4_2
'xref' and cross reference subsection header not separated by a single EOL marker.
@ e_PDFA5_2_12
A Page dictionary has an AA key.
@ e_PDFA7_3_9
Wrong value type for predefined XMP property.
@ e_PDFA7_8_6
'pdfaExtension:property' is using a wrong value type.
@ e_PDFA2_4_3
Image with invalid rendering intent.
@ e_PDFA7_11_5
Invalid PDF/A amendment identifier.
@ e_PDFA5_2_1
Unknown annotation type.
@ e_PDFA4_6
Transparency used ('ca' value is not 1.0).
@ e_PDFA3_5_6
CIDSet in subset font is incomplete.
@ e_PDFA7_8_8
'pdfaProperty:name' is using a wrong value type.
@ e_PDFA_4_6_6_3_1
A document catalog or a page dictionary contains an AA entry and its value contains key(s) not from t...
@ e_PDFA7_8_26
'pdfaField:valueType' not found.
@ e_PDFA6_10_0
PresSteps is not allowed.
@ e_PDFA_4_6_1_6_1_3
3D stream shall have a Subtype entry with a value which is either U3D or PRC.
@ e_PDFA_3E1_1
Embedded file Params has no ModDate entry.
@ e_PDFA1_8_3
Object number not preceded by EOL marker.
@ e_PDFA1_12_3
Name with more than 127 bytes.
@ e_PDFA0_1_2
Corrupt content stream.
@ e_PDFA3_5_7
Embedded Type1 font descriptor's CharSet string does not list all glyphs.
@ e_PDFA1_7_3
The value of Length does not match the number of bytes.
@ e_PDFA6_2_11_8
Use of .notdef glyph.
@ e_PDFA3_2_7
Widths array is missing or has invalid size.
@ e_PDFA3_3_1
Incompatible CIDSystemInfo entries.
@ e_PDFA2_6_1
Contains a reference XObject.
@ e_PDFA7_8_22
'pdfaType:namespaceURI' not found.
@ e_PDFA5_2_2
FileAttachment annotation is not permitted.
@ e_PDFA2_3_2
Not a valid ICC color profile.
@ e_PDFA2_5_10
HTP entry in ExtGState.
@ e_PDFA0_1_5
Contains cross-reference streams (PDF 1.4 compatibility).
@ e_PDFA7_2_1
The document catalog does not contain Metadata stream.
@ e_PDFA3_5_1
Embedded composite (Type0) font program does not define all font glyphs.
@ e_PDFA7_3_4
Document information entry 'Keywords' not synchronized with XMP.
@ e_PDFA_4_6_7_3_5
Invalid PDF/A revision.
@ e_PDFA0_1_0
Invalid PDF structure.
@ e_PDFA7_8_19
'pdfaType:type' not found.
@ e_PDFA_4_6_2_4_2_3
An ICCBased CMYK color space is identical to the current PDF/A OutputIntent color profile or the curr...
@ e_PDFA5_3_2_4
An annotation's 'Invisible' flag is set.
@ e_PDFA8_3_3_2
Each structure element dictionary in the structure hierarchy must have a Type entry with the name val...
@ e_PDFA2_10_20
Page Group entry is missing in a document without OutputIntent.
@ e_PDFA2_4_1
Image with Alternates key.
@ e_PDFA7_11_1
Missing PDF/A identifier.
@ e_PDFA7_3_8
Document information entry 'ModDate' not synchronized with XMP.
@ e_PDFA7_8_25
'pdfaField:name' is using a wrong value type.
@ e_PDFA7_3_5
Document information entry 'Creator' not synchronized with XMP.
@ e_PDFA9_3
AcroForms contains XFA.
@ e_PDFA5_3_2_2
An annotation's 'Print' flag is not set.
@ e_PDFA1_3_4
Linearized file: ID in 1st page and last trailer are different.
@ e_PDFA5_3_4_1
An annotation AP dictionary has entries other than the N entry.
@ e_PDFA_4_6_3_1_6
RichMedia annotation type is not permitted.
@ e_PDFA7_8_3
'pdfaExtension:schemas' not found.
@ e_PDFA7_8_14
The required field namespace prefix is 'pdfaType'.
@ e_PDFA7_8_16
'pdfaSchema:valueType' not found.
@ e_PDFA1_12_10
Bad Permission Dictionary.
@ e_PDFA5_3_3_3
An annotation's IC entry present but no OutputIntent present.
@ e_PDFA2_5_11
Unsupported HalftoneType.
@ e_PDFA4_3
Transparency used (Page or Form XObject with transparency group).
@ e_PDFA3_2_4
A BaseFont entry is missing or has invalid type.
@ e_PDFA1_12_6
The number of nested q/Q operators is greater than 28.
@ e_PDFA9_2
The NeedAppearances flag in the interactive form dictionary is set to true.
@ e_PDFA6_1_2
Contains a non-predefined Named action.
@ e_PDFA2_4_4
Image with Interpolate key set to true.
@ e_PDFA8_4_1
Invalid format for Lang entry in document catalog or in a structure element dictionary.
@ e_PDFA8_2_2
The PDF is not marked as Tagged PDF.
@ e_PDFA2_2_1
DestOutputProfile-s in OutputIntents array do not match.
@ e_PDFA1_3_2
Trailer dictionary contains Encrypt.
@ e_PDFA2_3_3_1
Device-specific color space used, but no GTS_PDFA1 OutputIntent.
@ e_PDFA2_9_1
Use of an invalid rendering intent.
@ e_PDFA3_2_5
A non-standard simple font dictionary has missing or invalid FirstChar entry.
@ e_PDFA7_11_3
Invalid PDF/A conformance level.
@ e_PDFA7_8_30
Required description for 'pdfaField::valueType' is missing.
@ e_PDFA1_12_14
Maximum number of DeviceN colorants (32) exceeded.
@ e_PDFA5_3_3_4
An annotation's IC entry present and OutputIntent has non-RGB destination profile.
@ e_PDFA3_3_2
Type 2 CIDFont without CIDToGIDMap.
@ e_PDFA3_7_3
A symbolic TrueType font does not have exactly one entry in cmap table.
@ e_PDFA1_8_1
Object number and generation number are not separated by a single white-space.
@ e_PDFA7_8_23
'pdfaType:field' is using a wrong value type.
@ e_PDFA5_2_9
Polygon annotation is not permitted.
@ e_PDFA7_8_13
The required field namespace prefix is 'pdfaProperty'.
@ e_PDFA3_7_2
A symbolic TrueType font must not specify encoding.
@ e_PDFA1_12_1
Array contains more than 8191 elements.
@ e_PDFA4_1
Transparency used (ExtGState with soft mask).
@ e_PDFA1_12_12
A conforming file shall not contain any string longer than 32767 bytes.
@ e_PDFA4_2
Transparency used (XObject with soft mask).
@ e_PDFA7_8_28
'pdfaField:description' not found.
@ e_PDFA2_3_4_1
Device-specific color space used in an alternate color space.
@ e_PDFA3_8_1
The font dictionary is missing 'ToUnicode' entry.
@ e_PDFA7_2_4
XMP property not predefined and no extension schema present.
@ e_PDFA1_12_5
Exceeds the maximum number (8,388,607) of indirect objects in a PDF file.
@ e_PDFA5_2_10
PolyLine annotation is not permitted.
@ e_PDFA6_1_1
Contains an action type that is not permitted.
@ e_PDFA7_2_5
XMP not included in 'xpacket'.
@ e_PDFA3_5_5
The font descriptor dictionary does not include a CharSet string for Type1 font subset.
@ e_PDFA4_5
Transparency used ('CA' value is not 1.0).
@ e_PDFA_4_6_2_10_8_1
The ActualText entry shall not contain any PUA values.
@ e_PDFA7_3_7
Document information entry 'CreationDate' not synchronized with XMP.
@ e_PDFA2_8_3_2
JPEG2000: Invalid number of colour channels.
@ e_PDFA0_1_3
Using JPEG2000 compression (PDF 1.4 compatibility).
@ e_PDFA_4_6_1_3_4
The Info key shall not be present in the trailer dictionary unless there exists a PieceInfo entry in ...
@ e_PDFA5_3_3_1
An annotation's C entry present but no OutputIntent present.
@ e_PDFA3_5_2
Embedded Type1 font program does not define all font glyphs.
@ e_PDFA5_3_3_2
An annotation's C entry present but OutputIntent has non-RGB destination profile.
@ e_PDFA1_2_1
Document does not start with % character.
@ e_PDFA3_2_2
A Font dictionary has missing or invalid Type entry.
@ e_PDFA2_3_10
Contains DestOutputProfileRef.
@ e_PDFA7_8_17
'pdfaSchema:valueType' is using a wrong value type.
@ e_PDFA5_3_4_3
AP has an N entry whose value is invalid.
@ e_PDFA7_8_12
The required field namespace prefix is 'pdfaSchema'.
@ e_PDFA2_4_2_12
tintTransform is different in Separations with the same colorant name.
@ e_PDFA1_12_2
Dictionary contains more than 4095 elements.
@ e_PDFA4_4
Transparency used (Blend mode is not 'Normal' or 'Compatible').
@ e_PDFA7_3_1
Document information entry 'Title' not synchronized with XMP.
@ e_PDFA2_4_2_11
Incorrect colorant specification in DeviceN.
@ e_PDFA5_2_11
Screen annotation is not permitted.
@ e_PDFA2_3_3_2
Device-specific color space, does not match OutputIntent.
@ e_PDFA3_7_1
A non-symbolic TrueType font must use WinAnsiEncoding or MacRomanEncoding.
@ e_PDFA1_8_2
Generation number and 'obj' are not separated by a single white-space.
@ e_PDFA7_3_6
Document information entry 'Producer' not synchronized with XMP.
@ e_PDFA3_3_3_2
Inconsistent WMode in embedded CMap dictionary and stream.
@ e_PDFA7_8_29
'pdfaField:description' is using a wrong type.
@ e_PDFA5_3_2_1
An annotation dictionary is missing F key.
@ e_PDFA7_8_21
'pdfaType:description' not found.
@ e_PDFA1_13_1
Optional content (layers) not allowed.
@ e_PDFA1_8_5
'obj' not followed by EOL marker
@ e_PDFA1_10_2
Invalid use of Crypt filter.
@ e_PDFA_4_6_2_10_6_1
For all non-symbolic TrueType fonts used for rendering, the embedded TrueType font program shall cont...
@ e_PDFA7_8_4
'pdfaExtension:schemas' is using a wrong value type.
@ e_PDFA6_9_1
Optional content Missing Name entry.
@ e_PDFA3_2_1
Embedded font is damaged.
@ e_PDFA2_5_12
Uses HalftoneName key.
@ e_PDFA1_7_4
A stream object dictionary contains the F, FFilter, or FDecodeParms keys.
@ e_PDFA2_3_3
The N entry does not match the number of color components in the embedded ICC profile.
@ e_PDFA7_8_27
'pdfaField:valueType' is using a wrong type.
@ e_PDFA11_0_0
Catalog contains Requirements key.
@ e_PDFA3_5_4
The font descriptor dictionary does not include a CIDSet stream for CIDFont subset.
@ e_PDFA1_12_9
A conforming file shall not contain any real number outside the range of +/- 3.403 x 10^38.
@ e_PDFA9_4
Catalog contains NeedsRendering.
@ e_PDFA2_4_2_13
alternateSpace is different in Separations with the same colorant name.
@ e_PDFA6_10_1
AlternatePresentations not allowed.
@ e_PDFA5_2_7
Caret annotation is not permitted.
@ e_PDFA1_10_1
Using LZW compression.
@ e_PDFA2_5_1
XObject with OPI key.
@ e_PDFA7_8_5
'pdfaExtension:property' not found.