I have attached all files for your reference.
So here problem is after processingacrobat_reader_screenshot.JPG (56.8 KB)
chrome_screenshot.JPG (80.7 KB)
CIARECRUITINGAD_RA.PDF (2.7 MB)
CIArecruitingAd_RA_ORG.pdf (1.4 MB)
PDF it is showing well on chrome browser (See screenshot chrome_screenshot.jpg) but on the Acrobat Reader it is showing error (see screenshot acrobat_reader_screenshot.jpg)
Attached file CIARECRUITINGAD_RA.pdf is PDF after procecssing. and CIArecruitingAd_RA_ORG.pdf file is before processing which is working good with acrobat reader so the only problem happens after we process PDf with the code (see code.txt file for code logic).
Here is the code:
public byte FillForm(string IPAddress, string SessionID, string UserName, string pdfPath, IDictionary<string, string> values)
var document = GetPdfDocument(_fileSystem.GetFullPath(pdfPath));
int count = 0;
foreach (var field in document.Form.Fields.Where(x => !string.IsNullOrEmpty(x.FullName)))
var rateMapperSplittedValue = values.ElementAt(count).Value.Split(';');
int index = rateMapperSplittedValue.Length - 1;
string labelValue = rateMapperSplittedValue[index];
field.Value = labelValue;
if (field.FullName != "undefined" && field.FullName != "Information" && field.FullName != "Text1")
field.ReadOnly = true;
var ms = new MemoryStream();
We tried to execute the code snippet in our environment and found that definition of a used Dictionary was missing:
Would you kindly share a sample console application in ZIP format which we can use to test and replicate the scenario you are facing.
I am hereby attaching the zip file for a sample console application. ChoiceFour_Flyer_RA is the original pdf. After filling the data from Aspose, the processed pdf is not shown in IE but it works with chrome.
Can you please run the console application and let me know what is missing? Thank you.
Here is the link to the zip file:
We have tested the scenario with the application which you have shared and were able to replicate the issue. The code in your application seemed fine. However, we have logged an issue as PDFNET-47236 in our issue tracking system for further investigation. We will further look into details of it and keep you posted with the status of its correction. Please be patient and spare us little time.
We are sorry for the inconvenience.
Thank you Asad. I am eagerly waiting for the reply.
The issue has been fixed. For some reason adobe reader doesn’t like trailing null. In the above code, I replaced:
return ms.GetBuffer(); ==>return ms.ToArray()
It is working fine on Firefox, and IE and we can open the processed pdf on adobe reader. You can close the ticket. Thanks.
It is good to know that your issue has been resolved and your comments would definitely help other facing similar issue. Please keep using our API and in case of any further assistance, please feel free to let us know.
We further investigated the ticket and found that the only issue is using GetBuffer() as described in your previous comment. Acrobat tries to find trailer if file is filled by trailing spaces after content. When ToArray() is used it is working fine. The ticket would be closed now.