function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lucena69lucena69 

render external pdf/blob in visualforce page

Hi,

 

I'm calling into a 3rd party API from Salesforce using the APEX WSDL wrapper. That 3rd party API provides access to pdf documents as blobs. I'm able to use APEX to access those PDFs and send them on as e-mail messages (using Messaging.SingleEmailMessage and Messaging.EmailFileAttachment) from salesforce. Works great.

 

However, I would like to also render that PDF in a VisualForce page (it can either render in the page or provide a popup asking the user if they want to save or open the PDF). I see lots of info on how to render existing Salesforce content in PDF but nothing about how you could do this if you already have the PDF in a blob lets say.

 

I would think it would be something like:

 

<apex:page contenttype="application/pdf">

<apex:outputText value="{!PDFBlob}" id="thePDFBlob"/>

</apex:page>

 

(where i can provide the blob in the controller) but outputText is not the correct component.)

 

Anyone have any ideas?

 

Thanks,

-John

 

 

TehNrdTehNrd
Hmmm, not quite sure how to do this exactly but one option may be to insert the blob as an attachement in salesforce and then you could display it in the page.
Kirtesh_JainKirtesh_Jain
try to convert  by using  .tostring() to string then display it .
nvgoghnvgogh

Hi

 

Did you find a solution to this?

 

I would like to do the same

 

Natalie

soofsoof

Hey everyone!

 

Any solution yet (other than saving as an attachment)???  Need this real bad!

 

Thanks.

dke01dke01

This is big problem, Please fix this salesforce!!!

 

I had the same issue trying to send a PDF via a webservice to APEX then render a VF page as PDF never found solution.

 

And now I have a VF page I want to render as PDF and save externally and this does not work either:

 

PageReference pr = new PageReference('/apex/mypage');
Blob pdf = pr.getContentAsPDF()

// code to send PDF to external site.

 

This code results in a Blank PDF no data in it due to String encoding issues.

I would really like to see string encoding handeled correctly and also allow for HttpRequest   setBody to allow a Blob instead of only strings

 

TN76TN76

Someone please give us a hand here!

 

I also need to programmatically (Apex) select a PDF file in either documents or static resources and display the PDF file in a pop up window.  This way the user can keep the PDF open to email, print, etc. while they continue working.  The PDF file would be an actual file I would upload to Document or StaticResources.

 

The Apex code to do this would be in a class method called from a page controller extension class method. 

 

The app is based on Force.com, it doesn't use the SF CRM objects.

 

Regards,

Ted

 

dturkeldturkel

Any updates?  Is there a post on Ideas that I should vote up?

narender.gupta01narender.gupta01

Did anyone found any solution / work around / best way to do this?

I'm also facing the same issue.

 

-Naren

gaparagapara

Did anyone found a solution to this one?