I have a PDF that has inputs, and those inputs have values.
When I try to load the PDF using the PDF Viewer, the PDF loads, but the inputs are empty.
Is there a solution for this?
Example of the PDF that is being used: https://www.canada.ca/content/dam/ircc/documents/pdf/english/kits/forms/imm5476/16-12-2022/imm5476e.pdf
Here is the code:
Hi Alex,
To view the form
fields in PDF Viewer, you need to inject the FormFields and FormDesigner
modules. We have provided a sample and documentation for this functionality.
Sample: Ibdmkd (forked) - StackBlitz
Documentation: Feature module in React Pdfviewer component | Syncfusion
Screenshot:
Kindly try this and let us know, if you have any concerns.
Thank you, when I add those 2 items in, I get the following client side error:
TypeError: Cannot read properties of null (reading 'includes')
Hi Alex,
We have tested the
given document in the below sample and the document is loaded in PDF Viewer
without any errors. We have provided the screenshot for this.
Sample: Ibdmkd (forked) - StackBlitz
Screenshot:
We request that you load the provided document in the above sample and confirm whether it works properly or not. If it works, please provide the modified sample, PDF Viewer version details. If the issue is specific to a document, please provide us with a copy of the PDF file. This information will assist us in further analyzing the problem and providing you with the necessary details.
Hi there, thanks for the response, can you try using the PDF that I provided here? I am running into the issue with that one.
Hi Alex,
Thanks for the document. We were able to reproduce the
reported scenario “Script error occurs when loading the
provided document”.
We will analyze further on this and update you with more details in two
business days on July 31, 2024.
Hi Alex,
We have logged this as a defect as "Script error occurs when loading the provided document" and will include the fix in our
weekly NuGet release, which is estimated to be available on August 21, 2024. You can track the status of the
issue through the following link.
Feedback link: Script
error occurs when loading the provided document | Issue Feedback
Disclaimer: "Inclusion of this solution in the weekly
release may change due to other factors including but not limited to QA checks
and works reprioritization."
Regards,
Sathiyaseelan K
Hi Alex,
We have fixed the
reported issue "Script error occurs when
loading the provided document" and the fix for the reported issue
was included in our latest weekly release v26.2.10. Kindly upgrade to that
version to get the issue resolved.
Root cause: We missed retrieving the checkbox and radio button form fields from the widget types, which caused the form fields to be rendered with the default type as text boxes, resulting in the issue.
Solution: We have properly retrieved the form field widgets for all types of form fields and update their properties accordingly. If the widget dictionary contains the parent key, it indicates that the widget is a radio button or checkbox with a group. Therefore, we have checked whether the widget dictionary includes the parent key and then retrieved the necessary values from the parent dictionary.
Packages:
CDN Links:
https://cdn.syncfusion.com/ej2/26.2.10/dist/ej2.min.js
https://cdn.syncfusion.com/ej2/26.2.10/material.css
https://cdn.syncfusion.com/ej2/26.2.10/dist/ej2-pdfviewer-lib/pdfium.js
https://cdn.syncfusion.com/ej2/26.2.10/dist/ej2-pdfviewer-lib/pdfium.wasm
Hi there, thank you for the response.
Unfortunately, this is still not working properly.
The errors I am seeing now are:
Client-side error is found. Please check the custom headers provided in the AjaxRequestSettings property and web action methods in the ServerActionSettings property.
And on some other PDFs, some of the pages are not loading and are stuck in the spinning circle.
Hi Alex,
The Syncfusion
service URL 'https://services.syncfusion.com/react/production/api/pdfviewer'
is intended for demo purposes only, and we update this URL frequently based on
new changes. We suspect that the issue occurred during one of these update
periods. However, we are unable to reproduce the reported issue at this time.
We have provided a video recording and sample for your reference.
Sample: Ibdmkd (forked) - StackBlitz
Video: VideoRecording
Additionally, you can create your own web service instead of relying on the Syncfusion service URL. Please refer to the documentation link below for instructions on how to create your own web service.
Documentation: Create pdfviewer service in EJ2 JavaScript Pdfviewer control | Syncfusion
Github sample: EJ2-PDFViewer-WebServices/ASP.NET Core/PdfViewerWebService_6.0 at main · SyncfusionExamples/EJ2-PDFViewer-WebServices (github.com)
Kindly try this and let us know, if you have any concerns.