PDF to PDF/A conversion: Textbox content gets misplaced

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);
}
}

Hi there,

Thanks for your inquiry. I have tested your scenario with shared document using Aspose.Pdf for Java 11.7.0 and managed to observe the reported issue. For further investigation, I have logged an issue in our issue tracking system as PDFJAVA-35991 and also linked your request to it. We will keep you updated via this thread regarding the issue status.

We are sorry for the inconvenience caused.

Best Regards,

@wroet001

Thanks for your patience.

We are pleased to inform you that earlier logged issue PDFJAVA-35991 has been resolved in Aspose.PDF for Java 18.1. Please try with latest version of the API and in case of any issue, please feel free to contact us.