I have a PDF that has fallible forms, I’m attempting to use the PdfFileMend tool (Aspose.Pdf.dll version 8.1.0.0) to add an image to it but when I do it messes up the pdf. Both the input and output pdf have been attached.
I have stripped down my code so simply bind to the pdf and save the output and get the same results:
MemoryStream msInPdfDoc = new MemoryStream(File.ReadAllBytes(@“C:\temp\W4.pdf”));
MemoryStream msOutPdfDoc = new MemoryStream();
Aspose.Pdf.Facades.PdfFileMend oPdfFileMend = new Aspose.Pdf.Facades.PdfFileMend();
oPdfFileMend.BindPdf(msInPdfDoc);
oPdfFileMend.Save(msOutPdfDoc);
oPdfFileMend.Close();
File.WriteAllBytes(@“C:\temp\W4_2.pdf”, msOutPdfDoc.ToArray());
When you open W4_2.pdf adobe reader gives a message stating:
This document enabled extended featurese in Adobe Reader. The document has been changed since it was created and the use of extended features is no longer available. Please contact the author for the original version of this file.
After you click ‘OK’ you can see the PDF (and the image when that code exists) but none of the fields are fallible anymore.
Also, worth noting is the documentation is outdated as it does not contain any information on the BindPdf and Sve methods:
Hi there,
Thanks for your inquiry. Please check following documentation link for preserving extended right features of document. Hopefully it will help you to fulfill your requirements.
Moreover, thank you for highlighting documentation issue. We are looking into it and will update it soon.
Please feel free to contact us for any further assistance.
Best Regards,
Unfortunately PdfFileMend does not have a simple Save method with no overloads.
So I tried switching over to an Aspose.Pdf.Document object so I could use the save method from above:
//Since the incoming stream may not be expandable by default, we have to create our own with unspecified size
MemoryStream rtnMS = new MemoryStream();
CopyStream(rtn, rtnMS);
//open document
Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(rtnMS);
//get the page where image needs to be added
Aspose.Pdf.Page page = pdfDocument.Pages[1];
//load image into stream
MemoryStream imageStream = new MemoryStream();
info.Image.Save(imageStream, info.Image.RawFormat);
page.AddImage(imageStream, new Aspose.Pdf.Rectangle(info.LowerLeftX, info.LowerLeftY, info.UpperRightX, info.UpperRightY));
pdfDocument.Save();
rtn = rtnMS;
I’ve also tried the more convoluted method from this page:
https://docs.aspose.com/pdf/net/working-with-images/
Neither of which returns the PDF with the image on it (though the fields are still fillable). I know the image is valid because if I write the imageStream out to a file it opens.
Please provide any feedback to fix my code or other workaround options you may have. Thank you.
Hi there,
Sorry for the delayed response. While testing the scenario with Aspose.Pdf for .NET 8.1, I’m unable to notice the issue, sample output enclose here. Can you please share a sample console application and source image as well? So we look into it at our end and provide you more information accordingly.
Sorry for the inconvenience faced.
Best Regards,
Please see the attached file for a test program. As you can see I am using the same coordinates for all of the file mend and the pdf document add image routines. (Note the file writing in the code is rough, it reads and writes files from the root folder, [bin\debug folder when running from VS).
Hi there,
Sorry for the inconvenience faced. I’ve observed the issue, extended features are being lost while we add image in PDF form using incremental approach. I’ve logged an investigation ticket as PDFNEWNET-35475 for further investigation and resolution. We will update you via this forum thread as soon as it is resolved.
Please feel free to contact us for any further assistance.
Best Regards,
Are there any updates on this? I noticed that a new version of the Aspose.PDF product was released but it looks like this hasn’t been looked into/resolved yet so is probably not included in the release?
Hi there,
Thanks for your inquiry. I’m afraid your reported issue is still not resolved and is pending for investigation in the queue with other priority tasks. We will update you about our findings/ETA as soon as its investigation completes.
Thanks for your patience and cooperation.
Best Regards,
Hi there,
Thanks for your patience. I would like to update you that your reported issue has been resolved and it will be included in upcoming release, Aspose.Pdf for .NET 8.3. After successful testing, it will be published in start of August, 2013. However we will update you once its published and gets available for download.
Best Regards,
I’m not sure what about this was fixed, if you put the newest DLL (8.3.1.0) in the test program provided above (https://forum.aspose.com/t/84098) you get the exact same results as before. No image on the PDF in either method 1 or 2 for adding the image and preserving the extended features.
The method that does post an image makes the form not fillable still behaves the same, but that’s just there to prove the image and location are valid.
Hi there,
Thanks for your feedback. I’m afraid the reported issue is still not resolved completely. Our development team has made some significant improvement towards resolution. However, we’ll update you via this forum thread as soon as its completely resolved.
Thanks for your patience and cooperation.
Best Regards,
Is there a new job id associated with it or will it be posted under the existing one? Are there any time estimates on this?
Thank you,
-Doug
Hi Doug,
Thanks for your inquiry. Please note existing issue id, PDFNEWNET-35475, will be used for the reported issue until issue is resolved completely. Moreover, your reported issue is resolved but it will be included in upcoming release 8.4 after successful testing. Please be patient , we will notify you about the fix as soon as new release is published.
We are sorry for the inconvenience.
Best Regards,
Unfortunately, once again, this was not fixed in the latest release (8.4.0) as promised.
Hi Doug,
We are truly sorry for inconvenience. I’m afraid fix again failed in final test so it is not included in 8.4.0 release. We are in coordination with our development team to investigate the failure and its solution. We will keep you updated about the issue progress.
Thanks for your patience and cooperation.
Best Regards,