ONLYOFFICE Docs v6.4 with conditional formatting, new scaling options, and WOPI protocol support
ONLYOFFICE Docs v6.4 released

How to download a doc in pdf the editor's way

Editor works great, we publish and get documents back through call back calls. Using OO 6.1.

However, there is one thing we would like to be able to do : request a document the same way it is done in File > Save as… > PDF. Why ? Because we don’t need to update the document on our server through the call back. And it so much quicker.

So, to sum up : we don’t want to convert a local file. We want to request the converted version of a remote file (in our case, docx to pdf). The same way the editor does…

Thanks !

Hello Philippe,

Please describe the situation in more detail. Are you using a desktop editor or are you editing a document in the cloud version?

Both the desktop editor and the cloud editor allow you to convert a file to PDF using the Save as … function:

  • in the desktop editor you need to select PDF in the Save as type field
  • in the editor in the cloud, you are also prompted to select the type of document, including PDF

Alternatively, you can save a file stored in the cloud as a PDF by clicking the down arrow button to the right of the file and selecting Download As.

Hello Andrew,

thanks for your reply.

We have installed ONLYOFFICE Docs community 6.1. Is this what you call ‘Desktop editor’…?

So , we want to do the same thing as Save as type field but programmatically.

On one server we’ve got ‘local’ files and call back page. On another server, we have OO. So, we don’t want to convert a local file (meaning we don’t want to request the Converter with the uri of a local file): we want to request a converted version (in PDF) of a remote (docx) file (file that has already been saved with the editor and sits on the OO server). The same way the editor’s Save as feature seems to work…

Does it make sense?

Hello Philippe.
I see a possible solution as follows:

  1. You can call downloadAs method to get loaded file URL: ONLYOFFICE Api Documentation - Methods
  2. The onDownloadAs() event handler sends the URL received from editor to your back-end application.
  3. your back-end application uses the received URL for a request to the conversion API to convert the file to pdf.

So there is no way we can call the Converter (or the api) with the target format (pdf) and the unique key of the file?

Sorry, but your desired scenario is not possible.

Besides the example web app, do you have some code that implements your solution ?

Unfortunately, we do not have a ready-made example that you could be guided by in your research.
Sorry for inconvenience.