Q: I am using the PDFNet SDK for merging (http://www.pdftron.com/
pdfnet/index.html), converting and validating pdf files into pdf/a-1b
files. Your PDF/A manager app can produce validation/conversion
reports in xml.
It did not find an API call in the PDFNet SDK to do that. Is it
possible to get an XML report generated?
--------------------------
A: PDFNet SDK does not have a built-in method to generate XML reports
similar to PDF/A Manager, however it should be fairly simple to
generate such report. You can reuse XSL (styling sheet) from PDF/A
Manager output so you only need to generate XML. For example (assuming
C++):
void OutputReport(PDFACompliance& pdfa,
const string& filename, const string& path)
{
cout << "<Validation>" << endl;
size_t err_cnt = pdfa.GetErrorCount();
if (!err_cnt) {
cout << " <Pass FileName=\"" << filename << "\" FileNameAndPath=\""
<< path << "\"></Pass>" << endl;
}
else {
cout << " <Fail FileName=\"" << filename << "\" FileNameAndPath=\""
<< path << "\">\n";
}
for (size_t i=0; i<err_cnt; ++i)
{
PDFA::PDFACompliance::ErrorCode c = pdfa.GetError(i);
const char* err = PDFA::PDFACompliance::GetPDFAErrorMessage(c);
cout << " <Error Code=\"e_PDFA" << int(c)
<< "\" Message=\"" << err
<< "\" Refs=\"";
size_t num_refs = pdfa.GetRefObjCount(c);
if (num_refs > 0) {
for (size_t j=0; j<num_refs; ) {
count << (int)pdfa.GetRefObj(c, j);
++j;
if (j!=num_refs) {
count << ", ";
}
}
}
cout << "\"/>\n";
}
}
cout << " </Fail>\n";
}
cout << "</Validation>";
}
}