adobe / pdfservices-node-sdk-samples

Samples for the Adobe Document Services PDF Tools Node SDK
MIT License
100 stars 26 forks source link

HTML-Conversion unsupported: Operation cannot be performed on the specified input media type : text/html #15

Closed jankammerath closed 3 years ago

jankammerath commented 3 years ago
Error: Operation cannot be performed on the specified input media type : text/html
at validateAllowedMediaType (/var/task/node_modules/@adobe/documentservices-pdftools-node-sdk/src/internal/util/validation-util.js:86:9)
at CreatePDFOperation.validate (/var/task/node_modules/@adobe/documentservices-pdftools-node-sdk/src/operation/create-pdf-operation.js:414:3)
at CreatePDFOperation.execute (/var/task/node_modules/@adobe/documentservices-pdftools-node-sdk/src/operation/create-pdf-operation.js:397:9)

Expected Behaviour

Convert html content to a PDF file

Actual Behaviour

Throw an exception

Reproduce Scenario (including but not limited to)

PDFToolsSdk.FileRef.createFromStream(Readable.from([htmlContent]),'text/html')

Steps to Reproduce

PDFToolsSdk.FileRef.createFromStream(Readable.from([htmlContent]),'text/html')

Platform and Version

Docker (Amazon Linux 2)

Sample Code that illustrates the problem

PDFToolsSdk.FileRef.createFromStream(Readable.from([htmlContent]),'text/html')

jankammerath commented 3 years ago

Got it resolved. The HTML content needed to be zipped as "index.html" and then pushed in with "application/zip".