+ Start a Discussion
ShikibuShikibu 

render a pdf with an embedded pdf or eps image?

I'm trying to style a page for renderas pdf. The following code works fine in html, but the image is broken when rendered to pdf. It's broken whether I use eps or pdf for the logo. I can render the png into pdf, but of course the quality is very low.

 

I'm pretty sure that the urlfor is correct (I rendered it as aoutput link to check it, and of course the png i s ion the

same zip file).

 

 

<apex:image value="{!if($CurrentPage.parameters.pdf == null, URLFOR($Resource.Logos, 'Logos/canonical_side_small.png'), URLFOR($Resource.Logos, 'Logos/canonical_side.eps'))}"/>

 

 

 

 Is it possible to render a pdf with an embedded pdf or eps image?

sfdcfoxsfdcfox
A PDF is not an image, you know. It's a document. It might contain an image, or even multiple images, but it's ultimately a document, and thus not an image. EPS isn't an Internet standard image format, so I'm not entirely suprised that it doesn't work either. To use an image in your PDF rendering, you'll need to stick with JPEG, PNG, or GIF. I just tested this, and it appears that Salesforce uses a lossy algorithm anyways, so no matter how nice your image is, even if it is EPS (were that supported), it'd still turn out a bit blurry compared to the original. The compression appears to be in the high 90% quality range. Also, I noticed that making the image larger than normal, then shrinking it a bit using width/height parameters seems to bring back some of the crispness.
ShikibuShikibu

I'm also not surprised that it doesn't work. But I doubt that what salesforce is doing is taking the rendered HTML and making some server bitmap image and PDF.

 

Rather, it looks like they interpret the HTML and use the utility iText to create a PDF. In that case it seems like it should be easy to reference any embedded EPS or PDF image.

 

However, I cooled my text and EPS and I discovered that embedded EPS capability has been removed from iText due to license problems.