Hi GroupDocs,
I am trying to generate a file with accessibility tags using JAVA SDK conversion library.
Below is the code I am using to convert docx file to PDF
try(ByteArrayInputStream is = new ByteArrayInputStream(contentInBytes)) {
try (Converter converter = new Converter(() → is)) {
try (ByteArrayOutputStream ms = new ByteArrayOutputStream()) {
PdfConvertOptions convertOptions = new PdfConvertOptions();
PdfOptions pdfOptions = convertOptions.getPdfOptions();
PdfFormats pdfFormats = pdfOptions.getPdfFormat();
pdfOptions.setPdfFormat(PdfFormats.PdfA_2A);
System.out.println("PdfFormats : " + pdfFormats.toString());
//PdfFormattingOptions formattingOptions = pdfOptions.getFormattingOptions();
//formattingOptions.setDisplayDocTitle(true);
PdfDocumentInfo pdfDocumentInfo = pdfOptions.getDocumentInfo();
String pdfDocumentTitle = isBase64Encoded(title) ? new String(Base64.decodeBase64(title), StandardCharsets.UTF_8) : title;
pdfDocumentInfo.setTitle(pdfDocumentTitle);
converter.convert(ms, convertOptions);
return ms.toByteArray();
}
}
} catch (IOException e) {
System.out.println(e.getMessage());
throw e;
}
But the document is getting generated with Adobe preflight. I wanted to generate document with the pdf/a compliance tags automatically. Could you please help me with the same. Attaching the picture on accessibility tags which we want
Screenshot 2024-05-22 at 8.46.52 AM.jpg (96.4 KB)