Amyuni PDF Creator .Net, 32 and 64-bits.
Problem Description
When opening and resaving a PDF file through PDF Creator .Net, the resulting PDF file opens fine with Acrobat Reader (AR), but when the document is closed AR asks the users whether they want to save the modifications to the PDF file. This is usually an indication that there is something invalid in the PDF file. The file has been fixed with AR which is asking whether the fixed file should be resaved. This issue seems to be occurring randomly depending on the original PDF and the type of processing that was done.
Cause and Resolution
The most common cause for this issue is the use of the OpenOrCreate flag when creating the .Net stream that is used to save the PDF file. E.g.:
Code: Select all
// Warning: This code might create an INVALID PDF file
using ( var stream = new FileStream( FileName, FileMode.OpenOrCreate ) )
{
pdfCreator.Document.Save( stream, IacFileSaveOption.acFileSaveView );
}
To check if the this is the case with your PDF file, open the PDF with a text editor and search for the %%EOF token. If there are any characters after %%EOF, then you are probably facing this same situation.
Resolution
Replace the flag FileMode.OpenOrCreate by FileMode.Create.
The reason why this is not done within the PDF Creator product (e.g. truncating the stream at the end of the file) is that the stream object belongs to the calling application. It might be a file, a memory, a database or any other custom stream class. Forcing a truncation of the stream might cause undesirable effects in the host application.