Find your content:

Search form

You are here

Issue in VF page with embedded pdf in mobile browsers

 
Share

I have a problem with rendering pdf documents using tag in VF page in mobile browsers.

Please, look, this is code of VF page:

<apex:page id="thePage" controller="myctrl"  action="{!doAction}" cache="false"> <object type="{!attach.ContentType}" data="servlet/servlet.FileDownload?file={!fileId}" id="c"> </object> </apex:page>

If i open this page in browsers in my PC - pdf is rendered successfully, but if i try to open this page in mobile broswers - i'm available to see only first page of pdf doc.

Did anybody solve this issue?

Thank you.


Attribution to: Julia

Possible Suggestion/Solution #1

This will probably have something to do with your pdf reader on your mobile device.

As salesforce only renders the PDF out of HTML/CSS and then provides the user's browser a link to that PDF, which basically means that it is up to the browser to handle the pdf. Either download it, or open with something like Adobe Acrobat (I think chrome has native PDF reading support build in)


Attribution to: pjcarly

Possible Suggestion/Solution #2

Two (mutually exclusive) options that might work:

  1. If you are not already doing so, I'd try keeping everything the same and setting the PageReference redirect attribute to true. If you are already doing that, or if doing so does not have the desired effect, then please consider option 2.

  2. Instead of using a VF page, just use the link to the PDF itself instead. So, in your controller, instead of returning a PageReference to a VF page, return one to the relative URL of the PDF file instead:

    servlet/servlet.FileDownload?file=fileId


Attribution to: shadit
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4731

My Block Status

My Block Content