Hi,
I don't know how I should put the document path in the "documentPath" variable so that the PDF Viewer displays the PDF correctly.
I am testing on localhost and I have the javascript inside this path:
c:\wamp\www\test\js\test.js
I have uploaded the PDF document inside the "js" folder:
c:\wamp\www\test\js\document.pdf
The code of the test.js to generate the PDF Viewer is this:
var pdfviewer = new ej.pdfviewer.PdfViewer({
documentPath: './document.pdf',
serviceUrl: 'http://xxxxxxx.com:6001/api/pdfviewer'
});But when I open the page, the PDF Viewer is displayed but it doesn't open the PDF document, it stays in gray background (it doesn't show any error message either).
The web service works correctly, if I access the path of the serviceUrl it shows me the text ["value1", "value2"]. The web service is created with the docker "syncfusion/pdfviewer-server" on an Ubuntu linux server.
How should be the path of the "documentPath" of the function in the test.js file to correctly display the PDF document? I have tried several ways to put the path but I can't get it to display.
Thank you very much.
I found a link where you explain how to get the content of the file with the GetDocument function of the Web Service API.
https://www.syncfusion.com/kb/10331/how-to-load-the-pdf-document-as-base64-string-in-pdf-viewer
I only have one doubt, where do I indicate the path of the document to convert?
Thank you very much.
EDIT:
Okay, now I have seen that it is indicated in the GetDocument function.
I'll try doing the same in PHP and I guess it should work.
Thanks.
Hi Pere,
Kindly refer the following steps to achieve your requirement.
2. Refer the document name in the documentPath and load
var pdfviewer = new ej.pdfviewer.PdfViewer({
documentPath: 'Syncfusion.pdf'
serviceUrl: 'http://xxxxxxx.com:6001/api/pdfviewer'
});
Kindly try the above suggestion to resolve your issue and let us know if resolved.
Regards,
Arun Kumar
Thank you very much for your response.
I have the documents on a different server than where the Web Service API is, so I have more complicated to upload the documents to the web service.
I think it will be easier if I get the string in base64 and pass it by Javascript to the PDF Viewer.
Thank you.
Hi Pere,
Thank you for your update.
Yes, you can use the base64 string content instead of providing path to resolve the problem.
Kindly refer the following UG documentation:
Load a Document using Base64string : https://www.syncfusion.com/kb/10331/how-to-load-the-pdf-document-as-base64-string-in-pdf-viewer
Load a Document using URL : https://www.syncfusion.com/kb/8737/how-to-load-a-pdf-document-from-url-into-pdf-viewer-from-client-side
Kindly try the above suggestion to resolve your issue and let us know if resolved.
Regards,
Arun Kumar
Hi,
We tried converting it to base64 and it worked correctly.
Thank you very much!
Hi Pere,
Thank You for your Response
Regards,
Arun Kumar