Dear Aspose Team,
we are experiencing a strange behavior when converting PDF to PDF/A using Aspose.PDF for java 11.7.0.
The PDF contains a vertical textbox with text on the left margin. It has two lines of text.
During the conversion to PDF/A, the lines lose their order to each other, so the lower text line appears above the other line and event gets scrambled.
Attached are the source and resulting PDF documents.
For reproducing the issue, we use a conversion like the following:
public byte[] convertToPdfa(byte[] content) throws Exception {
byte[] result = null;
ByteArrayOutputStream converted = new ByteArrayOutputStream();
ByteArrayOutputStream logStream = new ByteArrayOutputStream();
ByteArrayInputStream input = new ByteArrayInputStream(content);
Document doc = new Document(input);
boolean success = false;
try {
success = doc.convert(logStream, PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
if(!success) {
success = doc.convert(logStream, PdfFormat.PDF_A_2B, ConvertErrorAction.Delete);
}
doc.save(converted);
result = converted.toByteArray();
} catch (Exception e) {
logger.error(" : " + e.getMessage(), e);
throw new BdcException(MessageCodes.ConvertToPdfFormatFailed, StatusInfoSource.Converter, e);
} finally {
converted.close();
input.close();
logStream.flush();
logStream.close();
}
return result;
}
public void performBdcPdfaConversion(){
try {
byte[] pdfaConvertedByte = convertToPdfa( Files.readAllBytes( Paths.get(pdffilepath) ));
Files.write( Paths.get(pdffilepath2), pdfaConvertedByte );
} catch (IOException e) {
logger.error(e.getMessage(), e);
}
}