How to fetch docx and xlsx blobs as pdf from REST api or Java client

I am uploading docx, xlsx(excel files) and pdfs to nuxeo and able to see them in Nuxeo UI correctly.

Using the java client's method streamBlobByPath I am able to fetch the blob of document in my custom code. nuxeoClient.repository().streamBlobByPath(path, "file:content");

For the docx or xlsx files, when I use Nuxeo UI I am able to see the documents embedded in a pdf previewer.

How can I get the docx and xlsx as pdf blobs so it can be rendered by my custom pdf previewer?

I do not want the pdf previewer embedded in the blob. Just the content as pdf formatted blob.

0 votes

0 answers

2049 views

ANSWER

I can try a suggestion: leverage the automation https://explorer.nuxeo.com/nuxeo/site/distribution/server-10.10/viewOperation/Blob.ToPDF (or an automation chain leveraging this operation) to transform your Blob (XLSX, DOCX) to a PDF format and upload the resulting PDF using your custom PDF previewer.? The transformation from BLOB to PDF can be automated using event listeners at BLOB creation time.

Maybe a simpler solution exists…?

12/05/2019

Patrick Abgrall thanks for your comment. Does this conversion not happen automatically? So when nuxeo ui is fetching a docx file, the server has to do the transformation in realtime?
12/06/2019

The way I have described is in fact documented at https://doc.nuxeo.com/nxdoc/how-to-automatically-convert-a-document-to-pdf/ and https://doc.nuxeo.com/nxdoc/how-to-use-pdf-conversion-operations-with-studio/

Notice that https://doc.nuxeo.com/nxdoc/conversion/ gives some hints about another way to perform this via REST and a synchronous conversion in 1 URL .

12/06/2019