I use the DynamicPDF Merger software successfully with the code below:
Dim AdobeMergeDoc As New MergeDocument(PdfFileName)
'Merge all of the Membership data into the .pdf AdobeMergeDoc.Form.Fields(Pdf_LastName).Value = LastName
'Make form .pdf read only
AdobeMergeDoc.Form.IsReadOnly = True
'Set some final appearance properties
AdobeMergeDoc.InitialPageZoom = PageZoom.FitWidth
AdobeMergeDoc.InitialPage = 1
'Encrypt and Secure the document. This way once the .pdf is saved off it can NOT be modified.
AdobeMergeDoc.Security = New HighSecurity()
AdobeMergeDoc.Security.AllowCopy = False
AdobeMergeDoc.Security.AllowEdit = False
AdobeMergeDoc.Security.AllowUpdateAnnotsAndFields = False
'Show the .pdf in the page
AdobeMergeDoc.DrawToWeb()
This works most of the time, however recently one of my user's received an error stating "The file is damaged and could not be repaired". The user had Adobe Reader 7.0 installed. I tried repeadetly and could never get it to open successfully without the error. I then installed Adobe Reader 8.1.2 (the latest from Adobe) and it worked!
This tells me that the merged .pdf is not showing for older versions of the Adobe reader. Is there a property I can set in my MergeDocument object that will allow backwards compatibility?
Thank you!
File is damaged... error
Re: File is damaged... error
Support · Apr 15, 2008Hello,
Our product is compatible with the older versions of Adobe also. The reason for the error you are getting is most probably because of some stray HTML getting outputted along with the PDF stream. Please try adding the following line of code right after the DrawToWeb method and it will solve your problem.
Visible = False;
Thanks,
ceTe Software Support Team.
Re: File is damaged... error
Forum member · Apr 15, 2008Yes that did help. Once I incorporated that line of code, I still received a message, but it was much more meaningful. It had a pop-up stating that 'The PDF for requires a newer version of Adobe Acrobat. Although the form may appear to work properly...' Upon hitting 'OK' the .pdf did display.
Someone did suggest tweaking the .pdf from inside Acrobat via the 'PDF Optimizer' under the 'Advanced' menu and changing the compatibility. I changed it to' Adobe 6.0 or newer', but the message still appeared.
I am ok with that message though because it is detailed and does tell the user they need to upgrade.