Skip to main content
9 votes
Accepted

Programmatically generate Quote PDF in Lightning Component Apex controller

I've found a solution by experiment (with a hat tip to @KeithC, who got me speculating on a productive path), but I don't understand why it works/the direct path doesn't work. I would be happy to ...
David Reed's user avatar
  • 93.6k
7 votes
Accepted

Regex including curly brackets

Since backslashes are the escape character in Apex string literals, if you want a literal backlash, you need to escape it with a backslash. So the right regex to use would be \\{.*\\}
Derek F's user avatar
  • 64.1k
4 votes
Accepted

PageReference.GetContentAsPDF throws Internal Salesforce.com Error

If you add renderas="pdf" to the page, getContent will return a PDF of the page, and appears to still correctly throw an ExecutionException when the page throws an error (including uncatchable ...
IllusiveBrian's user avatar
4 votes

Programmatically generate Quote PDF in Lightning Component Apex controller

The getContentAsPDF call operates in a separate transaction. So if you make that call from within the transaction that sets up the data, that getContentAsPDF call will not see the data at all as the ...
Keith C's user avatar
  • 137k
4 votes

Border CSS not working properly with VF page rendered as pdf

The PDF engine that Salesforce still use AFAIK is Flying Saucer and that is far behind current CSS standards including to my knowledge not supporting rounded borders. So I'm afraid you will have to ...
Keith C's user avatar
  • 137k
3 votes
Accepted

Get content of local Visualforce Page from managed package code

Rendering an unmanaged page from within a Managed Package requires that you specify the default namespace within the page url. I would imagine that this is because by default, the platform is trying ...
Phil Hawthorn's user avatar
3 votes

Page getContent / getContentAsPDF not retrieving the updated data

This has been answered before but I can't find a good example. The problem is that the getContentAsPdf call does not see the changes made because it runs in a separate transaction and the current ...
Keith C's user avatar
  • 137k
2 votes

Salesforce VF - getContent() and getContentAsPdf() timeout

Adjusting the time out won't help you; you're presumably running in to the CPU governor limit if you've gone more than 10 seconds. Your only choice is to optimize your page and/or controller in order ...
sfdcfox's user avatar
  • 502k
2 votes
Accepted

Marketing Cloud Email Archival as PDF to FTP

There is really nothing you can do, to implement this natively in SFMC. My idea for such a solution would be following: Store the VAWP URL in sendlog. It will provide you with the web version of that ...
Lukas Lunow's user avatar
  • 22.2k
2 votes

Create Pdf from visualforce page with button

PageReference pdfPage2 = Page.pdfpage2; ... pdfBlob = pdfPage2.getContent(); This causes a new, separate instance of the controller to be loaded; it doesn't know about the variables in the original ...
sfdcfox's user avatar
  • 502k
2 votes
Accepted

getContentAsPDF() from batch Apex request works in scratch org but not production

Salesforce support was able to help me by pointing out that my profile had "Session Security Level Required at Login" set to High Assurance which forces MFA. High Assurance blocks processing ...
Dan's user avatar
  • 215
1 vote
Accepted

Guest User is generating and inserting Blank PDF through VF Page

So the problem was on the URL. I was using for the pageReference Page.vfPageName; for site guest users we will have to use the site URL for pageReference earlier I tried to use : pageRef = new ...
SHUBHAM GUPTA's user avatar
1 vote

How can we access visualforce page for pdf generation from a future annotated method

You are on the right path, grant the permission on either the Profile or Permission Set for the user to page 'pdfgeneratorpage' as Aditya mentioned.
Jeferson Chaves's user avatar
1 vote
Accepted

Blank PDF Generated on Use of getContentAsPDF on A VF Page When Called From an LWC Component on a Community Site

The way I've gotten around this is with Platform Events. Create a Platform Event that the Guest user has access to create. Then, create a trigger (after insert) on the Platform Event, and from there ...
mike537's user avatar
  • 141
1 vote

I want to pass collection variable to apex class

Invocable Apex is always implicitly bulkified Each element in the request corresponds to one Flow Interview Thus void pdfGeneratorTrialInitiation(List<ID> trialId) means that trialId[0] ...
cropredy's user avatar
  • 73.3k
1 vote

I want to pass collection variable to apex class

If you need to pass collection variable to apex class then you have to define List<List<id>> in your apex class as parameter for that method. If you want to pass just a single record or ...
SaiPraveen Kakkirala's user avatar
1 vote
Accepted

Trying to show PDF in Lightning web component in iFrame but it does not render the PDF file

solved this by making a change in the postmessage. Here's what I updated : this.template.querySelector('iframe').contentWindow.postMessage(this.pdfData, window.location.origin); I hope this helps ...
anxiousAvocado's user avatar
1 vote
Accepted

How can a VF page be attached to an email as a pdf attachment in landscape format?

You can apply landscape to the entire page using the @page CSS selector. Here is a fully functional version you can use as a starting point: <apex:page renderAs="advanced_pdf" showHeader=&...
sfdcfox's user avatar
  • 502k
1 vote
Accepted

Salesforce Visualforce Update Timing issue?

Since v34.0, both getContent and getContentAsPDF are treated as callouts. This means that a separate transaction is spawned, and the original is placed on hold. This is problematic, because it also ...
sfdcfox's user avatar
  • 502k
1 vote

Unknown Visualforce Error CompositeFont

Have you tried changing the font in the in-line CSS ? "style="font-family: 'Roboto', sans-serif;" Or recompiling the Apex class since that may be a java bug. https://bugs.openjdk.java.net/browse/JDK-...
Boris Gichev's user avatar
1 vote

Generating a PDF from a Lightning Page with LockerService restrictions

To get around LockerService restrictions you can use a VisualForce page and then you can create the components from lightning. See this question for info on how to host lightning components in ...
Aequitas's user avatar
  • 368
1 vote

Cache value not being saved in Org from Async call

Without seeing the design of your code, it's possible that either the results were not committed to the cache yet, the cache was invalidated for some reason, or the transaction exceeded the per ...
sfdcfox's user avatar
  • 502k
1 vote

Increase PDF height to show in one page

Try setting the page size in the <style> tag: <style> @page { size: 8.5in 11in; margin:0.0in; /* PDF width, height, margin */ } </style>
R Banks's user avatar
  • 11

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