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-2018 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 
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 
350  std::vector<unsigned char> SaveAs(bool linearized = false);
351 
352 #ifndef SWIG
353  void SaveAs(const char* &out_buf, size_t& out_buf_size, bool linearized = false);
354 #endif
355 
359  size_t GetErrorCount();
360 
369 
374  size_t GetRefObjCount(ErrorCode id);
375 
387  size_t GetRefObj(ErrorCode id, size_t err_idx);
388 
393  static const char* GetPDFAErrorMessage(ErrorCode id);
394 
398  ~PDFACompliance();
399 
403  void Destroy();
404 
406 #ifndef SWIGHIDDEN
407  PDFACompliance(TRN_PDFACompliance impl) : mp_pdfac(impl) {}
408  TRN_PDFACompliance mp_pdfac;
409 #endif
410 private:
412  PDFACompliance& operator= (const PDFACompliance&);
414 };
415 
416 
417  }; // namespace PDFA
418  }; // namespace PDF
419 }; // namespace pdftron
420 
421 #include <Impl/PDFACompliance.inl>
422 
423 #endif // PDFTRON_H_CPPPDFPDFAPDFACompliance
&#39;pdfaField:valueType&#39; not found.
The Metadata object stream contains Filter key.
&#39;pdfaProperty:valueType&#39; not found.
Some text can&#39;t be mapped to Unicode.
Transparency used (Page or Form XObject with transparency group).
PDFACompliance::ErrorCode GetError(size_t idx)
&#39;pdfaExtension:schemas&#39; 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.
&#39;pdfaType:field&#39; 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 &#39;Normal&#39;).
The required field namespace prefix is &#39;pdfaProperty&#39;.
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.
&#39;pdfaType:type&#39; is using a wrong value type.
&#39;endobj&#39; not preceded by EOL marker
Required property &#39;valueType&#39; missing in PDF/A Schema Value Type.
Catalog contains NeedsRendering.
An annotation&#39;s IC entry present but no OutputIntent present.
DestOutputProfile-s in OutputIntents array do not match.
Document information entry &#39;CreationDate&#39; not synchronized with XMP.
Optional content Contains AS entry.
&#39;xref&#39; and cross reference subsection header not separated by a single EOL marker.
&#39;pdfaField:description&#39; not found.
&#39;bytes&#39; and &#39;encoding&#39; attributes are allowed in the header of an XMP packet.
&#39;pdfaField:valueType&#39; 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&#39;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 &#39;endstream&#39; token is not preceded by EOL.
An annotation&#39;s &#39;Print&#39; flag is not set.
Transparency used (&#39;CA&#39; 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 &#39;pdfaExtension&#39;.
An annotation&#39;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 &#39;pdfaField::valueType&#39; is missing.
Polygon annotation is not permitted.
&#39;pdfaType:description&#39; not found.
Contains a non-predefined Named action.
&#39;pdfaField:name&#39; 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 &#39;pdfaSchema&#39;.
&#39;pdfaType:namespaceURI&#39; not found.
An annotation&#39;s &#39;Hidden&#39; flag is set.
&#39;pdfaField:description&#39; is using a wrong type.
JPEG2000: Only the JPX baseline is supported.
size_t GetRefObjCount(ErrorCode id)
A property doesn&#39;t match its custom schema type.
tintTransform is different in Separations with the same colorant name.
Document information entry &#39;Keywords&#39; not synchronized with XMP.
Object number not preceded by EOL marker.
Image with Interpolate key set to true.
XMP Extension schema doesn&#39;t have a description.
An annotation&#39;s &#39;NoView&#39; flag is set.
An annotation AP dictionary has entries other than the N entry.
AlternatePresentations not allowed.
FileAttachment annotation is not permitted.
&#39;pdfaProperty:name&#39; not found.
PUA characters are missing ActualText.
CIDSet in subset font is incomplete.
&#39;pdfaField:name&#39; not found.
&#39;pdfaType:type&#39; not found.
void SaveAs(const UString &file_path, bool linearized=false)
The font dictionary is missing &#39;ToUnicode&#39; 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 &#39;pdfaSchema:property&#39; sequence.
Optional content (layers) not allowed.
Embedded file Params has no ModDate entry.
&#39;pdfaExtension:property&#39; 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 &#39;Creator&#39; not synchronized with XMP.
Document information entry &#39;Title&#39; not synchronized with XMP.
Movie annotation is not permitted.
Doc catalog is missing AF entry.
Image with invalid rendering intent.
&#39;pdfaSchema:valueType&#39; is using a wrong value type.
An annotation AP dictionary does not contain N entry.
Transparency used (&#39;ca&#39; value is not 1.0).
&#39;pdfaExtension:schemas&#39; not found.
The PDF is not marked as Tagged PDF.
File header line not followed by % and 4 characters &gt; 127.
Invalid hexadecimal strings used.
Generation number and &#39;obj&#39; are not separated by a single white-space.
Document information entry &#39;ModDate&#39; not synchronized with XMP.
&#39;pdfaProperty:name&#39; 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 &#39;pdfaField&#39;.
Document information entry &#39;Subject&#39; 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.
&#39;pdfaSchema:valueType&#39; not found.
Screen annotation is not permitted.
XMP Extension schema is not valid. Required property &#39;namespaceURI&#39; 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 &#39;Producer&#39; not synchronized with XMP.
A non-symbolic TrueType font must use WinAnsiEncoding or MacRomanEncoding.
Sound annotation is not permitted.
An annotation&#39;s &#39;Invisible&#39; flag is set.
Inconsistent WMode in embedded CMap dictionary and stream.
Type 2 CIDFont without CIDToGIDMap.
&#39;pdfaExtension:property&#39; is using a wrong value type.
XMP not included in &#39;xpacket&#39;.
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 &#39;pdfaType&#39;.
Watermark annotation is not permitted.
A stream object dictionary contains the F, FFilter, or FDecodeParms keys.
&#39;obj&#39; not followed by EOL marker
The font descriptor dictionary does not include a CIDSet stream for CIDFont subset.
The &#39;stream&#39; token is not followed by CR and LF or a single LF.
Document information entry &#39;Author&#39; not synchronized with XMP.
A symbolic TrueType font does not have exactly one entry in cmap table.
Optional content Missing Name entry.
&#39;endobj&#39; not followed by EOL marker
static const char * GetPDFAErrorMessage(ErrorCode id)
Incorrect colorant specification in DeviceN.
An annotation&#39;s IC entry present and OutputIntent has non-RGB destination profile.
Invalid PDF/A amendment identifier.
PolyLine annotation is not permitted.

© 2002-2014 PDFTron Systems Inc.