I'm testing the ability to produce a PDF/A compliant file from a word doc. The file produced contains errors when validating the PDF. The following test demonstrates the problem.
I've also attached the test.doc file as well as the validation results file.
@Test
public void convertPdfCompliantDocumentFromWord() throws Exception {
Document doc = new Document(this.getClass().getResourceAsStream("/test.doc"));
ByteArrayOutputStream pdfBytes = new ByteArrayOutputStream();
PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.setCompliance(PdfCompliance.PDF_A_1_B);
doc.save(pdfBytes, saveOptions);
com.aspose.pdf.Document pdf = new com.aspose.pdf.Document(new ByteArrayInputStream(pdfBytes.toByteArray()));
ByteArrayOutputStream validationBytes = new ByteArrayOutputStream();
pdf.validate(validationBytes, PdfFormat.PDF_A_1B);
String validationXml = validationBytes.toString();
if (validationXml.contains("Problem")) {
fail("PDF compliance validations exist:\n" + validationXml);
}
}
Versions:
com.aspose
aspose-pdf
11.3.0
com.aspose
aspose-words
16.2.0
jdk16