Convert document to PDF using endpoint?

Hi, tried to search the documentation, but couldn't find what I want.

Is there an endpoint in the any of the webservices that can be used to generate a PDF based on a Word document in CRM?

RE: Convert document to PDF using endpoint?

No, SuperOffice does not have an API to convert a stored word document into a PDF. I believe some partners built application to do that in onsite installations. There is at least one in the online appstore.

Best regards.

Von: Tony Yates 23. Jun 2020

RE: Convert document to PDF using endpoint?

Ok, it would be nice if the built in NetServer functionality that uses Aspose for converting was exposed in the API as well. In customizations we often need to create a PDF of something. Typically for sending a contract or agreement of sorts to a customer. The approach we've used for years is to install wkhtmltopdf on the same server, and calling it via crmscripts runProgram method. Obviously this doesn't work in Online.

Also, for our apps in the appstore we also need to do some automatic PDF generating, and it would have been nice to be able to use the PDF generating mechanism that SuperOffice allready has.

The approach we're going to use is to call out to a API we're hosting somewhere to do the PDF generation there instead. If CRMScript/RestAPI had a way for us to create the PDF, we wouldn't need to send data anywhere else.

Von: Frode Lillerud 25. Jun 2020

RE: Convert document to PDF using endpoint?

GET /api/v1/document/123/content

vs

GET /api/v1/document/123/pdf

 

Would that work for you?

i.e. Existing documents as PDFs on demand?

This would error on things like XLS and PPT documents, anything not supported by the PDF generator we use, obviously.

Von: Christian Mogensen 25. Jun 2020

RE: Convert document to PDF using endpoint?

Christian, that would be a great addition! We normally use the same approach that Frode mentioned but a build-in way would be great.

Would it be possible to also make this work with input on demand? For example when you want to convert HTML to PDF in CS.

Von: David Hollegien 25. Jun 2020

RE: Convert document to PDF using endpoint?

I think SuperOffice should stick to converting things it controls, not provide a general PDF conversion service.

Von: Christian Mogensen 25. Jun 2020

RE: Convert document to PDF using endpoint?

Yes, /api/v1/document/123/pdf would be highly welcomed!

And to do that I assume you'd need to tack on a new method on the DocumentAgent? Somewhere along the lines of DocumentAgent.GetDocumentPDFStream? If so then that would also be available in CRMScript over time I hope.

Von: Frode Lillerud 26. Jun 2020

RE: Convert document to PDF using endpoint?

Christian, did you get a chance to implement the PDF feature for documents?

Von: Frode Lillerud 8. Sep 2020

RE: Convert document to PDF using endpoint?

Just checked in:

Send a document request with Accept application/pdf

GET http://localhost/crm.web/api/v1/document/71/content
Accept: application/pdf
Authorization: Basic tje1 Tje1

 

This will trigger conversion to PDF

HTTP/1.1 200 OK
Cache-Control: no-cache
Pragma: no-cache
Content-Type: application/pdf
Server: Microsoft-IIS/10.0
Date: Wed, 30 Sep 2020 08:25:17 GMT
Connection: close
Content-Length: 128910

%PDF-1.5
4 0 obj
<</Type /Page/Parent 3 0 R/Contents 5 0 R
Von: Christian Mogensen 30. Sep 2020

RE: Convert document to PDF using endpoint?

Thanks! Looking forward to testing it when it has trickled out to us.

Von: Frode Lillerud 30. Sep 2020

RE: Convert document to PDF using endpoint?

Looks really good - is this pdf conversion also available in CRM Online using CRM Script, or is it only available via REST?

I need to get a PDF version of a document before sending it off to a webservice externally, would be great if that could be done within SuperOffice instead of having to send a word document off to an external pdf converter. But i cannot find any CRMScript methods in the NSDocumentAgent class to do this :)

Von: Dennis Mortensgaard 8. Jan 2021