Transparency objects are still present in the PDF_A_2_A

Hi Team,

I have converted Docx to pdf. A transparency object and Transparent RGB are present after conversion. how to fix the problem.

I tested every PdfCompliance version, and every version had the same problem.

PDF_A_2_A --> Transparent object and Transparent RGB
PDF_A_2_U --> Transparent RGB
PDF_17 --> Transparent RGB
PDF_20 --> Transparent RGB
PDF_A_4 --> Transparent RGB
PDF_UA_1 --> Transparent object and Transparent RGB

Source code:

Document dstDoc = new Document(input.docx);
PdfSaveOptions options = new PdfSaveOptions();
options.getDownsampleOptions().setDownsampleImages(false);
options.setCompliance(PdfCompliance.PDF_A_2_A);
dstDoc.save(out_A_2_A.pdf,options);

Input: Input.docx (2.2 MB)

Sample Output out_A_2_A.pdf (1.4 MB)

Thanks in advance.

Regards,
Mahi

@Mahesh39 Aspose.Words do not remove transparency when saving to PDF and keeps the transparent objects as they are in the source Microsoft Word document. The only exception is saving to PDF/A-1 compliance where transparency is prohibited by specification. In this case Aspose.Words removes the transparency but it may cause visual difference comparing to the source document.

If you want to remove transparency you should do it by yourself either in source document or by postprocessing Aspose.Words PDF output.

@Konstantin.Kornilov, Thanks for your response.

I would appreciate it if you could share the sample code for both cases(Preprocess in Docx and Postprocess in pdf).

Note: In this case, we need to retain the document resolution also.

@Mahesh39 For preprocessing the document, you can try rendering your shape to the format that does not support transparency, for example to Jpeg (original format of the image in the document is EMF metafile). You can do this using ShapeRenderer. But this might lead to quality degradation since EMF metafile is vector format, but Jpeg is raster.

Regarding postprocessing it is better to ask in Aspose.PDF forum. my colleagues from Aspose.PDF team will help you shortly.