You need to sign in to do that
Don't have an account?

problem with rendering PDFs with images
Hello,
We are having two related issues with using images in our VF pages for our products that we want to render to PDF (we are running in a Sandbox with Summer '08):
1) when we include an image file from an external server , the page will not render at all and gives an error 500. No PDF is generated at all. We have tried bringing the image in using both a normal <img> tag as well as the <apex:image > tags. We have tried being in and out of developer mode, and have tried https and http URLs to the external server that is hosting the image. The image does show in a browser window when we remove the 'renderAs=PDF'. We have tried images of various sizes from multiple external servers and the results are always the same - will show in browser window, will not even render the pdf file.
2) We also have an image at the top of the page which is a Static resource in SF. this image is essentially our logo header. When we choose render as pdf, (and remove any external image links), the PDF will be generated however the logo file does not appear. Again, it shows if we remove the renderAs PDF. As soon as we try to render as PDF, the image disappears.
Any ideas? is there any more information that I can provide??
thanks!
However, the static resource case you describe in #2 should work. What type of file are you using for your logo file (e.g. jpeg, gif, etc)? Can post the part of your page that contains the image reference?
I understand your answer regarding the external images. This is a bummer for us as we do not and most likely will not store the images for our entire product catalog in Salesforce. Is there any plan to allow these in the future? We were rendering straight to PDF since this document is meant for printing, and when we print from the browser window we get the header and footer that the browser slaps on the the output which is no good.
Regarding the static resource Logo (case #2) - the file is a jpg. Below is the page that we are using to test both of these cases. As I mentioned, we have tried using normal <img> tags as well as the <apex:image> tag. (what is the best practice?)
THANK YOU for your help!
Message Edited by gireeshz on 06-04-2008 08:10 AM
Without The external image, my page worked fine using your markup, so not sure why its not working for you. Can you try following markup in you org and see what happens?
You sample worked. Mysteriously, our original page is working now as well. Wish i had a solid answer for you.
I hear you on the security issues - maybe we can find some other way of getting a good print from the browser window.
thanks to all..
may we run into the same issue, but let me explain. We build a visualforce page, where we would like to show grafical information in different charts. For the charts we use the google chart api. Now nearly finished, we see if we hava a VFP rendered as html it does work, but if we rendered it as pdf, then the area keeps blank. We could not show the charts in the pdf.
Any idea what is the reason for that?
Hi Doug,
We are creating a PDF document using Visual Force Page and the document has a logo ( a png or gif image file on header). Currently the image file is a static resource and using merge field the VF page is able to display it correctly. When we do the packaging the resource is also packaged and is getting installed without any issues.
Now we want to change the logo at the installed org , as the logo was bundled as static resource it cannot be modified so, we are trying to place the image in a document folder and refer it in VF page but the image is not displaying correctly . We have tried using url for the image but it is not working . Your help or a working example will be appreciated in resolving this issue.
<apex:image value="{!$Resource.gii__logo}"/>
We are trying to package the application as managed beta. The static resources gets locked in the target org.
So we are not able to change the logo.
Is there any way we can use a logo file from the document folder in
We already tried using the URL <apex:image url="/document/image/logo.jpg"/>. But it does not work..
Is there any way to get the URL for the documents within the org itself.
**This is very urgent, ** Your help is much appreciated
Message Edited by p1_dfs on 09-04-2008 06:10 PM
this has been a long standing bit of fun with Documents - something that has been on the backlog to be cleaned up to be like static resources from a name reference support standpoint - but for now this is the way it is.
Also, as a general rule when working with pdf generation you'll want to get your page working with renderAs="html" first and then switch it to renderAs="pdf".
is it safe to assume then that any document stored outside SF's walls will not work? What about a file stored in Appirio's Cloud Storage app, for example?
Your answer seems like the right idea - I completely support the reasons that you need to keep things locked down. however, in the case of an AppExchange-certified app, exceptions such as you mention would certainly increase the functionality available to the user.
cheers.
I have an image stored as a document in salesforce.com.
I have the code to retrieve the object, i. e.
<apex:image value="servlet " etc. />
The image displays fine as html.
The image displays fine as pdf, when running as system admin.
The image does not display with any other user profile.
What security setting in system admin needs to be carried to users so they can display the image?
I don't know of a specific permission that would cause this. We haven't really seen this pop up yet. Can the user see the page at all? Perhaps has something to do with the page security?
Also, I had problems in the pdf page with a third level data reference -
The field - slab__c.orderline__r.product__r.name - did not display unless I changed the user profile to "Read all data".
I ended up creating a reference field slab__c.product__c = to orderline__r.product__r.name. This works fine without enabling the data view.
And there is the problem with a 3-deep relational variable.
Doug - this is fantastic news!! Thank you so much for keeping track of this and helping us out.
Will this be 'testable' in the sprin '09 preview sandbox orgs?
Thanks for the tip on setting up the remote site for rendering images as PDFs.
This is allowing the PDF to generate but I am getting different results for the dynamically created image which is in the PDF and in the body of the visualforce email template.
The email version works perfectly. Calling the same code results in the URL for the dynamic image failing to resolve correctly.
<apex:image url="{!relatedTo.ri__dynamic-image-URL__c}" ></apex:image>
The URL is long with 226 chars. Is this a problem in the PDF?
Works fine in the email template