Hello,
I am combining multiple pdf files with the PdfFileEditor Concatenate function (memory stream array to single memory stream). See attached file for cut-down code.
The resulting pdf always brings up a message in Adobe Acrobat (reader or editor) that, ‘This file is damaged but is being repaired’.
The file opens ok but there is always a request to save the repaired file on closing Acrobat. I want to avoid this request to save so need to create an ‘undamaged’ file.
At the moment I am just saving the byte array from PdfFileEditor Concatenate memstream output with a ‘.pdf’ file extension. Do I need to finalize it somehow? I have tried creating a pdf document object from the memstream and then saving that but same problem.
Aspose pdf is version 9.5.0.0.
Thanks!
Hi Simon,
Hello,
Yes, that is exactly the problem we are facing.
I think if you construct a larger pdf then you will see the ‘The file is damaged…’ message as Acrobat takes a moment to process it.
Thanks for investigating!
Hi Simon,
Hello,
Unfortunately we do not want to create extra files on the filesystem (i.e. using FileStream in C#) as the pdf being concatenated may be confidential. MemoryStream is preferred.
Your colleague Tilal Ahmad has recreated the problem exactly so I don’t think you need a sample application from us.
Thanks for your help!
Hello,
I can confirm that Concatenate does work with array of FileStream but this is not a good solution for us. Is the problem with MemoryStream something you will be able to fix?
Thanks!
Hi Simon,
Hello,
I have been able to work around this problem. It seems that writing to MemoryStream is simply adding a lot of extra rubbish data to the stream. Restricting what is read back from the stream (C# .ToArray or, better, restricted length .GetBuffer) allows a valid pdf file to be constructed (Acrobat does not complain or ask to save after viewing).
Thanks for your help!
Hi Simon,
The issues you have found earlier (filed as PDFNEWNET-38530) have been fixed in Aspose.Pdf for .NET 10.4.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.