0

There is a PDF which worked perfectly rendering png or jpg images, but now the images are being uploaded to salesforce they are webp format.

I have not been able to render this type of images in the pdf. If I remove the renderAs = PDF then the image does render perfectly.

  <apex:image url="{!URLFOR($Action.Attachment.Download, imageId)}"/> //Not Work in PDF
  <apex:image value="data:image;base64,{!datab64}" /> ////Not Work in PDF

Has it happened to anyone? is it possible render a webp into a PDF.?

4

PDF does not support webp, and Flying Saucer, the PDF renderer for Salesforce (and other programs), does not support webp; it would need to translate the webp file into a JPEG file to be usable in PDF. As a consequence, these images can't be displayed inside the PDF. You'll need to use a supported format. The reason why the page shows the image in the browser is because the browser supports webp, and can therefore display it.

3
  • Thank you very much for your answer @sfdcfox. – ojedawinder Oct 20 '20 at 13:28
  • Is there any way to do this conversion in apex code to convert a webp image to jpg and then display this jpg image in the pdf @sfdcfox – ojedawinder Oct 20 '20 at 14:20
  • 1
    @ojedawinder Not directly. You could probably call an external service (e.g. on Heroku) to do this, but Apex doesn't have good binary support, and I don't know of any JPEG + webp libraries for Apex. – sfdcfox Oct 20 '20 at 14:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.