Could not call API in Webviewer

Please give a brief summary of your issue:

As we have started to develop pdftron Webviewer,
We could not call the API in java script using server URL to load documents in webviewer
Kindly help us to solve the issue or share any documents related to this issue

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hello,

Thank you for contacting PDFTron WebViewer.

We could not call the API in java script using server URL to load documents in webviewer
Are you saying that you are having problems with WebViewer when you load documents with WebViewer Server? If yes, could you let me know if there’s any errors? If not, could you elaborate on the problem here?

Best Regards,
Jason Hu
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

Kindly share any sample code for calling the API in java script to load the pdf documents.

Hello,

You can find different ways to load documents here: PDFTron.

Please let me know how this works for you, and if you have any questions.

Best Regards,
Jason Hu
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

We have tried with the methods but not working . So provide alternate solution to call the API.

Hello,

Would you be able to share why it is not working? Is there any error in the console? Would you be able to attach your WebViewer Configuration code?

Best Regards,
Jason Hu
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

We are in the process of evaluating the WebViewer for Form fields – adding, editing, saving, Extracting form fields data, Flattening, Comments & Annotation, Signature capabilities, from a web page.

PDF Documents which are to be used in WebViewer are available in a file repository.

File repository exposes REST APIs to upload and download files.

To load a document in the WebView, file repository’s download REST API needs to be called first. The API returns the base64 data as JSON. When this API is called from client side code of the web page, CORS policy violation error is encountered. When I tried with a server side handler (.Net ashx), encountered “ Access to XMLHttpRequest at ‘http://localhost:50361/HandleFile.ashx?method=GET’ from origin ‘http://localhost:8080’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. :50361/HandleFile.ashx?method=GET:1 ” error.

Can you please share a sample code (or) methodology with which PDFs can be loaded to WebViewer using REST API. And also, how to save the PDF from WebViewer using the REST API to the file repository. This would help me to proceed with the evaluation.

Thanks in advance.

Hello,

Thank you for the detailed explanation. It looks like you are loading files from a different domain. If that is the case, please check out this guide.

As for saving the file, you could refer to this guide.

Please let me know how this works for you, and if you have any questions.

Best Regards,
Jason Hu
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

We found below 2 ways of flatterning the pdf document using pdftron.

  1. Flatten a PDF on Cross-Platform (Core) i.e loading pdf file from the url
    PDFTron Systems Inc. | Documentation

  2. Flattern a PDF document by loading inside the webviewer.
    PDFTron Systems Inc. | Documentation

Our Requirement is to flattern the pdf file from the pdf file data read in any of these (base64/blob/array) formats,
without loading inside webviewer.

Can you please share the sample code to met our requirement?

PDFTron Systems Inc. | Documentation

World’s #1 PDF SDK Library for Web, Mobile, Server, Desktop

Hello,

You could use this guide:PDFTron Systems Inc. | Documentation.
Please let me know how this works for you, and if you have any questions.

Best Regards,
Jason Hu
Web Development Support Engineer
PDFTron Systems, Inc.
www.pdftron.com

1.How to adjust the font size of augmented textfield box during fill and sign mode selection.
such that Font Size to be changed dynamically inside the textfield box, so the input data can be adjusted to fit inside the provided space
of textfieldbox.
2.How to make Multiline or extended text to be visible after flattern the document.
3.How to fit the data to the augmented textfield box without trimming the data,
such that entire input content should be visible within the provided textfieldbox space.

Can you please provide solution for the above queries.