1

I'm running into an issue that I've been unable to solve surfing the web.

I am storing USPS shipping labels I am receiving from an HTTP request using ContentVersion. I would like for the user to be able to click a button to be redirected to a new tab with the VFP displaying the PDFs in the Content Versions. I have tried many different "solutions" including passing in the base64 to an iframe tag and also passing in the content version ID like so:

<apex:repeat value="{!contentVersionIds}" var="vId">
    <div style="page-break-after: always;">     
        <iframe src="/sfc/servlet.shepherd/version/download/{!vId}" type="application/pdf"></iframe>
    </div>
</apex:repeat>

After all I have found and tried, I still am unable to get a PDF Content Version to render on a VFP as a PDF. The best I've been able to get to render is a gray broken image tag. There has to be a way for this to work I would think.

As of right now, each label preview has an anchor tag with src="/sfc/servlet.shepherd/version/download/{!versionId}" so that the user can open/download/view/print the label but it only displays that one label. When there is more than one label to print the process becomes unnecessarily tedious and slow for the shipping team.

Thanks in advance.

~Holden

1 Answer 1

1

After doing more research I found a post asking the same question and it can be viewed here.

tl;dr

It's not possible to render a PDF that contains another PDF inside of it. The Salesforce PDF render engine can't render a Blob image. Any images need to be standard formats such as JPG, PNG, GIF, or TIFF images. There might be a few others that are supported as well, but definitely not blobs. An existing PDF will essentially contain a wrapper around a JPG along with additional information about how to display and print it.

This post was made over 4 years ago but I wouldn't be surprised if it is still correct with all I've tried. Maybe one day there will be a way!

~Holden

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.