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?
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.
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.
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.
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.
I think SuperOffice should stick to converting things it controls, not provide a general PDF conversion service.
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.
Christian, did you get a chance to implement the PDF feature for documents?
Just checked in:
Send a document request with Accept application/pdf
Authorization: Basic tje1 Tje1
This will trigger conversion to PDF
HTTP/1.1 200 OK
Date: Wed, 30 Sep 2020 08:25:17 GMT
4 0 obj
<</Type /Page/Parent 3 0 R/Contents 5 0 R
Thanks! Looking forward to testing it when it has trickled out to us.
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 :)