I understand from documentation that annotation can be directly merged into PDF document itself. I found a Web viewer API( getFileData ) available to retrieve PDF data with annotations and using this API, I can retrieve the PDF data with annotations and overwrite the original PDF on the server. Let me know if my understanding on web is correct or not?
I am looking for similar API for React Native , Could you please share one and how to use this API? Also want to know how can I trigger this API on a custom button action like Save button.
Hi @mohan.kathireddy ,
The API you are looking for is saveDocument. This will return the temp file path of the PDF document that you can then use to either upload to your server or any other purpose.
You can trigger this in your own UI by calling it directly. For the custom button, I would recommend adding it as an overlay to the viewer, or part of your application toolbar. Hope this helps.
@Shirley_G , Thanks for the information. I understand from documentation that annotations are supported for 30+ file formats. I want to know whether merging annotation data is supported for all file types? If so in what format annotation data is stored for these file types(Ex: Word, PPT, Excel, JPG, PNG, etc…)?
Hi @mohan.kathireddy ,
With PDFTron, you can convert documents (i.e. Word, PPT, JPG, etc…) to PDF and annotate on the converted documents. Merging annotation data is only supported on PDF documents.
Could you describe your use case for merging annotation data?
At present we are implementing PDF rendering and annotation using PDFTron. Since PDFTron allows to merge annotations to PDF in XFDF format, we are using this approach to merge annotations directly to PDF instead of maintaining this information in a separate data source. And I believe this approach would let the user to simply download the PDF document and view annotations using Acrobat reader outside the App.
In future, we may extend this functionality to other file types like office files, images, drawing files, etc. and as per my understanding XFDF is adobe format and not sure whether this works for other file types. So, I am trying to understand how PDFTron handles annotations for other file types.
As you mentioned above, Is converting other file types to PDF only option or does PDFTron provides other options also like directly add annotations to native document ? If converting to PDF is the only option then I believe only App developed using PDFTron can render it and not sure how I can send this data to external systems.
Currently the PDFTron React Native SDK does not support adding annotations to non-PDF documents. Importing XFDFs are only supported for PDF documents.
As for adding annotations, PDFTron supports converting non-PDF documents to PDF and allows you to annotate on the resulting PDF using the annotation tools.
As for your specific use case could you consider contacting PDFTron support here: https://www.pdftron.com/company/contact-us/ ? We can further discuss your needs and requirements via our support channel, and we’ll be able to provide you with more detailed solutions tailored to your needs.
Do you have a sample code how to get file from temp file path? Also want to know how to cleanup this temporary file? Does PDFTron takes care of this?
The files that open through a URL in React Native will be stored in the folder defined by openUrlpath:
By default the folder is the cache folder, so files will be automatically cleaned up by the Android system.
If your files are local, then getDocumentPath will return the path to your local file:
These files will not be cleaned up automatically, and you will need to manage them manually.
PDFTron Systems, Inc.
World’s #1 PDF SDK Library for Web, Mobile, Server, Desktop
CONFIDENTIALITY NOTICE: This message (and any attachment to it) is intended only for the use of the individual or entity to which it is addressed in the header, and may contain information that is privileged, confidential and exempt from disclosure under applicable law. Any reproduction, distribution, modification or use of the contents of this message (and any attachment to it) by any individual or entity other than the intended recipient is prohibited. If you have received this communication in error, please notify us immediately and delete the original.