Hot answers tagged

15 votes

Status of renderAs advanced_pdf

As of Summer '18, this pilot program has been cancelled. The service didn't quite meet the scalability goals we needed. Safe harbor, we're working on a way to bring the program back and adapt it to ...
Mike's user avatar
  • 734
14 votes
Accepted

External Image Link Broken when Rendering as PDF

I just figured this out after 30 minutes of Googling and thought a concise post may help others in future. It was not documented in the SFDC documentation but was on an different post from 2012. Is ...
S Morgan Robertson's user avatar
14 votes
Accepted

My Header and Footer overlaps with the content in a PDF Visualforce Page

I think the main issues is that you should put your margin measurements in the @page element and remove them from the content div. For readability, i've put this all in one VF page: <apex:page ...
Phil Hawthorn's user avatar
10 votes

Render Visualforce page as PDF in landscape orientation

You have to use applyBodyTag="false" attribute in <apex:page tag as explained in Visualforce Developer Guide to render the PDF properly. I checked with the below code and I am able to render the ...
Saroj Bera's user avatar
  • 14.6k
10 votes
Accepted

Open PDF in browser instead of Downloading

This was actually solved by setting the pdf filetype to 'Execute in Browser' from Setup -> Security Controls -> File Upload and Download Security
G Takei's user avatar
  • 193
9 votes
Accepted

Visualforce RenderAs PDF not supporting SLDS CSS

It is a common assumption that the HTML to PDF engine presently used by Salesforce is Flying Saucer that only supports version 2.1 of CSS (W3C Recommendation 07 June 2011) whereas SLDS is designed to ...
Keith C's user avatar
  • 135k
9 votes
Accepted

How to generate a PDF and have it download from a Lightning Web Component

You can use download.js to implement this functionality. The main idea is to convert the PDF into Base64 encoded String and pass it to the download method of download.js. Which will show the file ...
Saroj Bera's user avatar
  • 14.6k
8 votes
Accepted

Visualforce PDF : how to display footer on ALL pages?

I finally resolve my problem by putting the <div class="footer"><some footer here</div> BEFORE the content of my page. This way I can see the footer on all the pages. If any of you know ...
dou's user avatar
  • 1,909
7 votes

Download Invoice PDF's On List View without saving to Notes and Attachment as a zip file

Kudos to @SFDCGOD for suggesting this. I was so intrigued by his suggestion, I gave it a try. First, I created resources for each of the Javascript files (FileSaver.js and jszip.js) and then created ...
Phil Hawthorn's user avatar
7 votes
Accepted

How would I create a PDF in salesforce on any object WITHOUT using ANY code

This is a salesforce native functionality. Just add Create PDF button in Invoice Layout. Added Images for your reference. As you don't mention previously that you want to use it for all object then ...
Tushar Sharma's user avatar
7 votes
Accepted

Barcodes generation for VF PDF reports

I have personally written a barcode component that works with PDF. It's actually pretty easy. The actual component is self-contained: <c:barcode codeValue="12345" /> Edit: Please be ...
sfdcfox's user avatar
  • 481k
7 votes
Accepted

Collection size 1.079 exceeds maximum size of 1.000

Adding readOnly="true" to the Visualforce page should fix your problem as explained in Setting Read-Only Mode for an Entire Page. Note that this will raise the limit from 1,000 to 10,000 so ...
Keith C's user avatar
  • 135k
6 votes
Accepted

Batch Apex and performance

The batch apex is complete asynchronous process and it will execute in its own thread and hence it will not impact any data flow of your salesforce other process unless your other process depend on ...
Mohith Shrivastava's user avatar
6 votes
Accepted

Download Invoice PDF's On List View without saving to Notes and Attachment as a zip file

You can do following to achieve this: Add following javascript in your page FileSaver.min.js Blob.js jszip.min.js Pass All Id's to controller and just get there data by getContetnAsPdf one by ...
ashishcloud's user avatar
  • 1,050
6 votes
Accepted

pageBlockTable - row number variable is not incremented

The dataTable and pageBlockTable elements do weird things for content outside of apex:column elements (usually by way of ignoring the content entirely). If you put the counter inside a column, it will ...
sfdcfox's user avatar
  • 481k
6 votes

Why am I not able to get full 60 second CPU time in @future method with getContentAsPDF()

getContentAsPDF actually internally performs a callout back into Salesforce as a new transaction. This means that the actual CPU time used for the primary transaction doesn't account for the time used ...
sfdcfox's user avatar
  • 481k
6 votes
Accepted

Generate PDF with REST Web service

See getContentAsPDF() after insert a record in the same excution context that explains that the PDF generation call won't see any changes made in the transaction that calls it. If you don't require ...
Keith C's user avatar
  • 135k
6 votes
Accepted

css trouble using visualforce renderas PDF

I think it is because of this: font-family: Arial Unicode MS; If you replace it with: font-family: sans-serif; It should work ok. From Wikipedia: ....it (sic) contains Roman (upright) glyphs ...
Phil Hawthorn's user avatar
6 votes
Accepted

Visualforce <style> tag outputting as text in PDF

The renderer only accepts style formats in the head section of the page: <apex:page StandardController="Project__c" extensions="projectToPDFController" renderAs="pdf" ...
sfdcfox's user avatar
  • 481k
6 votes
Accepted

Issue in PDF generation of a LWC component in Visualforce

The PDF renderer does not support JavaScript, but Aura and LWC components are always loaded via JavaScript. That means it is impossible to use renderAs to render an Aura Component or LWC component in ...
sfdcfox's user avatar
  • 481k
5 votes
Accepted

how to include image as header/logo in a visualforce pdf page

have u tried with @top-center ? like : @top-center { content: "Sample Header Test"; background-image: url('{!$Resource.YOUR_IMAGE}'); } You can use other way for reducing image size like : ...
Arjun Khatri's user avatar
  • 1,328
5 votes

Visualforce page rendered PDF shows a strange error,

Remove the development mode toolbar by clicking on the X or whatever closes it on the right side of the bar. It can mess with things
Eric's user avatar
  • 54k
5 votes
Accepted

≤ not displayed in vf page, renderAs pdf

Update and complete solution for pdf rendering with Special characters If the PDF file fails to display all the page’s text, particularly multibyte characters such as Japanese or accented ...
Santanu Boral's user avatar
5 votes
Accepted

Preview PDF file on visualforce page

I have used the object tag to display a PDF static resource so I assume this will work for your PDF link: <object data="{!linkToPdfFile}" width="100%" style="height: 500px; ...
Keith C's user avatar
  • 135k
5 votes
Accepted

Save base64 data as Attachment

Did you set the contentType as application/pdf? I tried this following code and it is working for me. String jsonStr = '<Base64 String>'; Attachment attach = new Attachment(); attach....
Saroj Bera's user avatar
  • 14.6k
5 votes
Accepted

Visualforce Page renderAs pdf styling does not apply

CSS transforms are not supported in PDF mode. Also, anything that starts with "-moz", "-ms", "-o", or "-webkit" are not supported. You'll have to find a CSS1- or CSS2-level support design that meets ...
sfdcfox's user avatar
  • 481k
5 votes
Accepted

How to display downloaded PDF blob in an iframe?

You have to alter your getPDF() method and prepend data:application/pdf;base64, public String getPDF() { return 'data:application/pdf;base64,'+EncodingUtil.base64Encode([SELECT VersionData ...
Pranay Jaiswal's user avatar
5 votes
Accepted

How to get past the URL limit error of maximum 4096 characters?

There are a few options, but basically you need to get the bulk data out of the query string. Typically you would do this by using a POST request rather than a GET request. Since a PageReference ...
Daniel Ballinger's user avatar
4 votes

Render PDF Blob data in visualforce page

Although this post is old, I came across the same problem and found a solution. As @jkraybill mentioned above, Visualforce will not emit binary data. This means we can't retrieve a Blob from ...
Wes Lyons's user avatar
  • 146
4 votes

Can't use getContent() in a batch, future method, trigger etc

In the past, we were using an HTTP request to achieve this. However, as of Winter '16, Salesforce allows calls to getContent() and getContentAsPdf() within asynchronous Apex (batch, future methods). ...
Emily Carpenter's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible