Disable creation of ConversionLog.xml

Hello,

when we generate a pdf from scratch, a file named ConversionLog.xml is generated. Is there a way to disable this?

@schiepe

Thank you for contacting support.

ConversionLog.xml file is usually generated while creating a PDF/A document, which can be disabled by passing a stream instead of the file name as first parameter for convert method. Please try below code snippet with Aspose.PDF for Java 19.3 and then share your kind feedback with us.

ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document pdfDocument = new Document(dataDir + "Test.pdf");
pdfDocument.convert(baos, PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
pdfDocument.save(dataDir + "output_19.3.pdf");

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

Hello,

we have defined PdfFormatConversionOptions for the conversion:

PdfFormatConversionOptions ops = new PdfFormatConversionOptions(PdfFormat.v_1_4);
ops.setOptimizeFileSize(true);
ops.setLowMemoryMode(true);
ops.setTransparencyAction(ConvertTransparencyAction.Mask);
pdfDocument.convert(ops);

How can we use the PdfFormatConversionOptions in conjunction with disabling the generation of ConversionLog.xml as i did not find a convert method with arguments stream and PdfFormatConversionOptions.

@schiepe

Thank you for elaborating it further.

We have used below code with Aspose.PDF for Java 19.3 and did not notice creation of ConversionLog.xml file. Please try using below code in your environment and then share your kind feedback with us.

ByteArrayOutputStream baos = new ByteArrayOutputStream();
Document pdfDocument = new Document(dataDir + "Test.pdf");
PdfFormatConversionOptions ops = new PdfFormatConversionOptions(PdfFormat.v_1_4);
ops.setOptimizeFileSize(true);
ops.setLowMemoryMode(true);
ops.setLogStream(baos);
ops.setTransparencyAction(ConvertTransparencyAction.Mask);
pdfDocument.convert(ops);
pdfDocument.save(dataDir + "output_19.3.pdf");

Thanks for your help, it worked!