All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PDFACompliance.h
Go to the documentation of this file.
1 //---------------------------------------------------------------------------------------
2 // Copyright (c) 2001-2020 by PDFTron Systems 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 
14 namespace pdftron {
15  namespace PDF {
16  namespace PDFA {
17 
52 {
53 public:
54 
68  {
78  };
79 
80  enum ErrorCode
81  {
82  // PDF/A-1 Level B Validation Errors --------------------------------
89  e_PDFA1_2_1 =121,
90  e_PDFA1_2_2 =122,
91  e_PDFA1_3_1 =131,
92  e_PDFA1_3_2 =132,
93  e_PDFA1_3_3 =133,
94  e_PDFA1_3_4 =134,
95  e_PDFA1_4_1 =141,
96  e_PDFA1_4_2 =142,
97  e_PDFA1_6_1 =161,
98  e_PDFA1_7_1 =171,
99  e_PDFA1_7_2 =172,
100  e_PDFA1_7_3 =173,
101  e_PDFA1_7_4 =174,
102  e_PDFA1_8_1 =181,
103  e_PDFA1_8_2 =182,
104  e_PDFA1_8_3 =183,
105  e_PDFA1_8_4 =184,
106  e_PDFA1_8_5 =185,
107  e_PDFA1_8_6 =186,
108  e_PDFA1_8_7 = 187,
109  e_PDFA1_10_1 =1101,
110  e_PDFA1_11_1 =1111,
111  e_PDFA1_11_2 =1112,
112  e_PDFA1_12_1 =1121,
113  e_PDFA1_12_2 =1122,
114  e_PDFA1_12_3 =1123,
115  e_PDFA1_12_4 =1124,
116  e_PDFA1_12_5 =1125,
117  e_PDFA1_12_6 =1126,
118  e_PDFA1_13_1 =1131,
119  e_PDFA2_2_1 =221,
120  e_PDFA2_3_2 =232,
121  e_PDFA2_3_3 =233,
125  e_PDFA2_4_1 =241,
126  e_PDFA2_4_2 =242,
127  e_PDFA2_4_3 =243,
128  e_PDFA2_4_4 =244,
129  e_PDFA2_5_1 =251,
130  e_PDFA2_5_2 =252,
131  e_PDFA2_6_1 =261,
132  e_PDFA2_7_1 =271,
133  e_PDFA2_8_1 =281,
134  e_PDFA2_9_1 =291,
135  e_PDFA2_10_1 =2101,
136  e_PDFA3_2_1 =321,
137  e_PDFA3_3_1 =331,
138  e_PDFA3_3_2 =332,
141  e_PDFA3_4_1 =341,
142  e_PDFA3_5_1 =351,
143  e_PDFA3_5_2 =352,
144  e_PDFA3_5_3 =353,
145  e_PDFA3_5_4 =354,
146  e_PDFA3_5_5 =355,
147  e_PDFA3_5_6 =356,
148  e_PDFA3_6_1 =361,
149  e_PDFA3_7_1 =371,
150  e_PDFA3_7_2 =372,
151  e_PDFA3_7_3 =373,
152  e_PDFA4_1 =41,
153  e_PDFA4_2 =42,
154  e_PDFA4_3 =43,
155  e_PDFA4_4 =44,
156  e_PDFA4_5 =45,
157  e_PDFA4_6 =46,
158  e_PDFA5_2_1 =521,
159  e_PDFA5_2_2 =522,
160  e_PDFA5_2_3 =523,
161  e_PDFA5_2_4 =524,
162  e_PDFA5_2_5 =525,
163  e_PDFA5_2_6 =526,
164  e_PDFA5_2_7 =527,
165  e_PDFA5_2_8 =528,
166  e_PDFA5_2_9 =529,
167  e_PDFA5_2_10 =5210,
168  e_PDFA5_2_11 =5211,
169  e_PDFA5_3_1 =531,
183  e_PDFA6_1_1 =611,
184  e_PDFA6_1_2 =612,
185  e_PDFA6_2_1 =621,
186  e_PDFA6_2_2 = 622,
187  e_PDFA6_2_3 = 623,
188  e_PDFA7_2_1 =721,
189  e_PDFA7_2_2 =722,
190  e_PDFA7_2_3 =723,
191  e_PDFA7_2_4 =724,
192  e_PDFA7_2_5 =725,
193  e_PDFA7_3_1 =731,
194  e_PDFA7_3_2 =732,
195  e_PDFA7_3_3 =733,
196  e_PDFA7_3_4 =734,
197  e_PDFA7_3_5 =735,
198  e_PDFA7_3_6 =736,
199  e_PDFA7_3_7 =737,
200  e_PDFA7_3_8 =738,
201  e_PDFA7_3_9 =739,
202  e_PDFA7_5_1 =751,
203  e_PDFA7_8_1 =781,
204  e_PDFA7_8_2 =782,
205  e_PDFA7_8_3 =783,
206  e_PDFA7_8_4 =784,
207  e_PDFA7_8_5 =785,
208  e_PDFA7_8_6 =786,
209  e_PDFA7_8_7 =787,
210  e_PDFA7_8_8 =788,
211  e_PDFA7_8_9 =789,
212  e_PDFA7_8_10 =7810,
213  e_PDFA7_8_11 =7811,
214  e_PDFA7_8_12 =7812,
215  e_PDFA7_8_13 =7813,
216  e_PDFA7_8_14 =7814,
217  e_PDFA7_8_15 =7815,
218  e_PDFA7_8_16 =7816,
219  e_PDFA7_8_17 =7817,
220  e_PDFA7_8_18= 7818,
221  e_PDFA7_8_19= 7819,
222  e_PDFA7_8_20 =7820,
223  e_PDFA7_8_21 =7821,
224  e_PDFA7_8_22 =7822,
225  e_PDFA7_8_23 =7823,
226  e_PDFA7_8_24 =7824,
227  e_PDFA7_8_25 =7825,
228  e_PDFA7_8_26 =7826,
229  e_PDFA7_8_27 =7827,
230  e_PDFA7_8_28 =7828,
231  e_PDFA7_8_29 =7829,
232  e_PDFA7_8_30 =7830,
233  e_PDFA7_8_31 =7831,
234  e_PDFA7_11_1 =7111,
235  e_PDFA7_11_2 =7112,
236  e_PDFA7_11_3 =7113,
237  e_PDFA7_11_4 =7114,
238  e_PDFA7_11_5 =7115,
239  e_PDFA9_1 =91,
240  e_PDFA9_2 =92,
241  e_PDFA9_3 =93,
242  e_PDFA9_4 =94,
243 
244  // PDF/A-1 Level A Validation Errors --------------------------------
245  e_PDFA3_8_1 =381,
246  e_PDFA8_2_2 =822,
250 
251 
252  // PDF/A-2 Level B Validation Errors --------------------------------
253  e_PDFA1_2_3 =123,
254  e_PDFA1_10_2 =1102,
255  e_PDFA1_10_3 =1103,
256  e_PDFA1_12_10 =11210,
257  e_PDFA1_13_5 =1135,
258  e_PDFA2_3_10 =2310,
259  e_PDFA2_4_2_10 =24220,
260  e_PDFA2_4_2_11 =24221,
261  e_PDFA2_4_2_12 =24222,
262  e_PDFA2_4_2_13 =24223,
263  e_PDFA2_5_10 =2510,
264  e_PDFA2_5_11 =2511,
265  e_PDFA2_5_12 =2512,
271  e_PDFA2_10_20 =21020,
272  e_PDFA2_10_21 =21021,
273  e_PDFA11_0_0 =11000,
274  e_PDFA6_10_0 =6100,
275  e_PDFA6_10_1 =6101,
276  e_PDFA6_2_11_5 =62115,
277  e_PDFA6_2_11_6 =62116,
278  e_PDFA6_2_11_7 =62117,
279  e_PDFA6_2_11_8 =62118,
280  e_PDFA6_9_1 =69001,
281  e_PDFA6_9_3 =69003,
282  e_PDFA8_1 =81,
283 
284  // PDF/A-3 Validation Errors --------------------------------------
289 
291  };
292 
293 
308  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);
309 
326  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);
327 
328 
337  void SaveAs(const UString& file_path, bool linearized = false);
338 
347  std::vector<unsigned char> SaveAs(bool linearized = false);
348 
349 #ifndef SWIG
350 
361  void SaveAs(const char* &out_buf, size_t& out_buf_size, bool linearized = false);
362 #endif
363 
367  size_t GetErrorCount();
368 
377 
382  size_t GetRefObjCount(ErrorCode id);
383 
395  size_t GetRefObj(ErrorCode id, size_t err_idx);
396 
401  static const char* GetPDFAErrorMessage(ErrorCode id);
402 
409 
413  ~PDFACompliance();
414 
418  void Destroy();
419 
420 #ifndef SWIGHIDDEN
421  PDFACompliance(TRN_PDFACompliance impl) : mp_pdfac(impl) {}
422  TRN_PDFACompliance mp_pdfac;
423 #endif
424 private:
426  PDFACompliance& operator= (const PDFACompliance&);
427 };
428 
429 
430  }; // namespace PDFA
431  }; // namespace PDF
432 }; // namespace pdftron
433 
434 #include <Impl/PDFACompliance.inl>
435 
436 #endif // PDFTRON_H_CPPPDFPDFAPDFACompliance
The Metadata object stream contains Filter key.
'pdfaProperty:valueType' not found.
Some text can't be mapped to Unicode.
Transparency used (Page or Form XObject with transparency group).
PDFACompliance::ErrorCode GetError(size_t idx)
'pdfaExtension:schemas' is using a wrong value type.
XMP property not predefined and no extension schema present.
Widths in embedded font are inconsistent with /Widths entry in the font dictionary.
JPEG2000: The bit-depth JPEG2000 data must be in range 1-38.
AP has an N entry whose value is invalid.
'pdfaType:field' is using a wrong value type.
Page Group entry is missing in a document without OutputIntent.
Using JPEG2000 compression (PDF 1.4 compatibility).
The NeedAppearances flag in the interactive form dictionary is set to true.
Transparency used (Blend mode is not 'Normal').
The required field namespace prefix is 'pdfaProperty'.
A non-standard structure type does not map to a standard type.
Subsection header: starting object number and range not separated by a single space.
The number of nested q/Q operators is greater than 28.
An annotation dictionary contains the CA key with a value other than 1.0.
'pdfaType:type' is using a wrong value type.
'endobj' not preceded by EOL marker
Required property 'valueType' missing in PDF/A Schema Value Type.
Catalog contains NeedsRendering.
An annotation's IC entry present but no OutputIntent present.
DestOutputProfile-s in OutputIntents array do not match.
Document information entry 'CreationDate' not synchronized with XMP.
Optional content Contains AS entry.
'xref' and cross reference subsection header not separated by a single EOL marker.
'pdfaField:description' not found.
'bytes' and 'encoding' attributes are allowed in the header of an XMP packet.
'pdfaField:valueType' is using a wrong type.
Device-specific color space used in an alternate color space.
Document does not start with % character.
An annotation dictionary is missing F key.
An annotation's C entry present but OutputIntent has non-RGB destination profile. ...
The trailer dictionary does not contain ID.
Transparency used (XObject with soft mask).
Wrong value type for predefined XMP property.
Trailer dictionary contains Encrypt.
An interactive form field contains an action.
Linearized file: ID in 1st page and last trailer are different.
The 'endstream' token is not preceded by EOL.
An annotation's 'Print' flag is not set.
Transparency used ('CA' value is not 1.0).
Embedded file has no MIME type entry.
Caret annotation is not permitted.
The required namespace prefix for extension schema is 'pdfaExtension'.
An annotation's C entry present but no OutputIntent present.
alternateSpace is different in Separations with the same colorant name.
Array contains more than 8191 elements.
Required description for 'pdfaField::valueType' is missing.
Polygon annotation is not permitted.
'pdfaType:description' not found.
Contains a non-predefined Named action.
'pdfaField:name' is using a wrong value type.
FileSpec is missing F or UF key.
Contains compressed object streams (PDF 1.4 compatibility).
The document catalog does not contain Metadata stream.
The required field namespace prefix is 'pdfaSchema'.
'pdfaType:namespaceURI' not found.
An annotation's 'Hidden' flag is set.
'pdfaField:description' is using a wrong type.
JPEG2000: Only the JPX baseline is supported.
size_t GetRefObjCount(ErrorCode id)
A property doesn't match its custom schema type.
tintTransform is different in Separations with the same colorant name.
Document information entry 'Keywords' not synchronized with XMP.
Object number not preceded by EOL marker.
Image with Interpolate key set to true.
XMP Extension schema doesn't have a description.
An annotation's 'NoView' flag is set.
An annotation AP dictionary has entries other than the N entry.
AlternatePresentations not allowed.
FileAttachment annotation is not permitted.
PUA characters are missing ActualText.
CIDSet in subset font is incomplete.
void SaveAs(const UString &file_path, bool linearized=false)
The font dictionary is missing 'ToUnicode' entry.
Catalog contains Requirements key.
Incompatible CIDSystemInfo entries.
The value of Length does not match the number of bytes.
Use of an invalid rendering intent.
The XMP Metadata stream is not valid.
Contains cross-reference streams (PDF 1.4 compatibility).
Each structure element dictionary in the structure hierarchy must have a Type entry with the name val...
Contains an integer value outside of the allowed range [-2^31, 2^31-1],.
A description for a property is missing in 'pdfaSchema:property' sequence.
Optional content (layers) not allowed.
Embedded file Params has no ModDate entry.
'pdfaExtension:property' not found.
Exceeds the maximum number (8,388,607) of indirect objects in a PDF file.
Device-specific color space used, but no GTS_PDFA1 OutputIntent.
Contains an XObject that is not supported (e.g. PostScript XObject).
Document information entry 'Creator' not synchronized with XMP.
Document information entry 'Title' not synchronized with XMP.
Movie annotation is not permitted.
Doc catalog is missing AF entry.
Image with invalid rendering intent.
'pdfaSchema:valueType' is using a wrong value type.
An annotation AP dictionary does not contain N entry.
Transparency used ('ca' value is not 1.0).
PDFACompliance(TRN_PDFACompliance impl)
'pdfaExtension:schemas' not found.
The PDF is not marked as Tagged PDF.
File header line not followed by % and 4 characters > 127.
Invalid hexadecimal strings used.
Generation number and 'obj' are not separated by a single white-space.
Document information entry 'ModDate' not synchronized with XMP.
static PDFACompliance::Conformance GetDeclaredConformance(const PDF::PDFDoc &in_doc)
'pdfaProperty:name' is using a wrong value type.
Embedded TrueType font program does not define all font glyphs.
A symbolic TrueType font must not specify encoding.
The required field namespace prefix is 'pdfaField'.
Document information entry 'Subject' not synchronized with XMP.
Redact annotation is not permitted.
Device-specific color space, does not match OutputIntent.
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)
Embedded file has no AFRelationship.
JPEG2000: All colour channels in the JPEG2000 data must have the same bit-depth.
Page dimensions are outside of the allowed range (3-14400).
The font descriptor dictionary does not include a CharSet string for Type1 font subset.
The document catalog dictionary contains AA entry.
'pdfaSchema:valueType' not found.
Screen annotation is not permitted.
XMP Extension schema is not valid. Required property 'namespaceURI' might be missing in PDF/A Schema ...
Invalid PDF/A identifier namespace.
JPEG2000: Invalid number of colour channels.
Object number and generation number are not separated by a single white-space.
size_t GetRefObj(ErrorCode id, size_t err_idx)
Embedded composite (Type0) font program does not define all font glyphs.
Contains an action type that is not permitted.
Document information entry 'Producer' not synchronized with XMP.
A non-symbolic TrueType font must use WinAnsiEncoding or MacRomanEncoding.
Sound annotation is not permitted.
An annotation's 'Invisible' flag is set.
Inconsistent WMode in embedded CMap dictionary and stream.
Type 2 CIDFont without CIDToGIDMap.
'pdfaExtension:property' is using a wrong value type.
Contains an invalid Transfer Curve in the extended graphics state.
Embedded Type1 font program does not define all font glyphs.
Dictionary contains more than 4095 elements.
A file specification dictionary contains a non-compliant embedded file (EF key).
Transparency used (ExtGState with soft mask).
The N entry does not match the number of color components in the embedded ICC profile.
The required field namespace prefix is 'pdfaType'.
Watermark annotation is not permitted.
A stream object dictionary contains the F, FFilter, or FDecodeParms keys.
'obj' not followed by EOL marker
The font descriptor dictionary does not include a CIDSet stream for CIDFont subset.
The 'stream' token is not followed by CR and LF or a single LF.
Document information entry 'Author' not synchronized with XMP.
A symbolic TrueType font does not have exactly one entry in cmap table.
Optional content Missing Name entry.
'endobj' not followed by EOL marker
static const char * GetPDFAErrorMessage(ErrorCode id)
Incorrect colorant specification in DeviceN.
An annotation's IC entry present and OutputIntent has non-RGB destination profile.
Invalid PDF/A amendment identifier.
PolyLine annotation is not permitted.