We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

PDF Concatenate locks generated PDF file

Hey,

I’m evaluating your PDF SDK and I really love it so far.

I have the need to concatenate a lot of PDF files (can be more than 500 up to several thousands).

I’m using the following code:

// create PdfFileEditor object
PdfFileEditor pdfMerger = new PdfFileEditor();
pdfMerger.CloseConcatenatedStreams = true;
pdfMerger.ConcatenationPacketSize = 10;
pdfMerger.UseDiskBuffer = true;
pdfMerger.ConvertTo = PdfFormat.PDF_A_1B;
// concatenate files
pdfMerger.Concatenate(pdfFilePaths, mergedPDFPath);

After concatenation is done, I can’t open the resulting PDF as it’s still locked. I tried to encapsulate it with “using”, but PDFFileEditor doesn’t seem to have the IDisposable interface implemented. So far I only succeed to open the resulting PDF after I close my application. I haven’t found a “Close” or similar method for PdfFileEditor. Setting the object to null doesn’t seem to work either.

Is there a way to get rid of that file lock?

Best regards,
Georg

Hi Georg,


Thanks for contacting support.

It appears that you are using legacy Aspose.Pdf.Facades approach for PDF concatenation. However we recommend using Document class of Aspose.Pdf namespace for PDF file creation, manipulation and concatenation. When using this approach, the resources are released when process is completed and in case you need to exclusively release the resources, please try using Dispose(…) method of Document object.

For more information, please visit Concatenate PDF Files.

In case you still face any problem, please share some resource files causing this problem in your environment, so that we can further look into this matter. We are sorry for this inconvenience.

Hi Georg,


Thanks for your interest in Aspose.Pdf. Please note you can not convert PDF to PDFA while merging PDF documents. Please use ConvertTo property can be used set PDF versions(1.3.1.4.1.5,1.6) instead PDFA standards. You may convert merged PDF to PDFA using following documentation link. Hopefully it will resolve the issue.


// create PdfFileEditor object<o:p></o:p>

PdfFileEditor pdfMerger = new PdfFileEditor();

pdfMerger.CloseConcatenatedStreams = true;

pdfMerger.ConcatenationPacketSize = 10;

pdfMerger.UseDiskBuffer = true;

pdfMerger.ConvertTo = PdfFormat.v_1_5;

...

Please feel free to contact us for any further assistance.


Best Regards,