5

There's no way to combine PDFs as such. What you would need to do is generate your PDF in a different way, i.e. from a List as opposed to the single record. You can utilise the visualforce that you have already, and place it in an <apex:repeat/> block. For example, instead of e.g. <apex:page standardController="Account" renderAs="pdf"> <...


3

There are a number of AppExchange packages that can generate a PDF using a template- Conga, Drawloop, and Thunderhead are three well known ones. Generally these templates are built in Word or another editor though - not HTML or Visualforce. Document generation for most of these products is "ad-hoc" - users click on a button in Salesforce to generate the ...


3

This isn't a limitation of APEX so much as it is of the PDF render engine. Think of the PDF document render engine as a printer and you'll understand that it can only accept certain kinds of images. It doesn't know what a base64 blob image is. Instead, it needs to know whether the image is a JPG, GIF, PNG, etc and the number of pixels wide and tall it is. ...


2

Visualforce does not emit binary data. As such, there is no direct way I'm aware of to render a PDF blob to the user using Visualforce. The one semi-exception I know of is that you can cause a browser to render an image file (not PDF) using base 64 data URL's. Your best bet is probably to save the PDF blob as an Attachment object, and then redirect the ...


2

You can't directly compose a PDF from a text area and a blog image. Instead, they need to be "rendered" or "Printed" as a PDF in some kind of composition program or what some refer to as a "RIP" (the equivalent of Adobe Acrobat Exchange). The only way I know of that you can do something like this from within Salesforce is to output the text area content ...


2

Although certainly not the only culprits to mucking up a straight-forward conversion from a VF markup to PDF using the "renderAs" tag... I would carefully review all your CSS or other style markups, as they tend to cause failures in the PDF rendering engine if not carefully-considered. It is, shall we say, not so easy to get a good PDF rendering with a nice ...


2

Blob.toPDF() should work with a simple HTML input string. So you might do something like the following (untested): <html><body><img src="data:image/jpeg;base64,dGVzdA==" /><p>Additional Content</body></html> Please be aware, that Blob.toPDF() has always been very buggy in the interpretaion of the HTML, that you may throw ...


2

By using getContentAsPDF, you can get a visualforce's page content as a pdf, regardless of the pages renderAs attribute. You won't be able to perform DML on the file object directly, since its a label for the ContentDocument & ContentVersion objects. You'll need to create one of those records instead. Id someID = '000000000000000'; PageReference ref ...


2

This is because you din't create class instance and called the class method. As this is a extension class and not a trigger handler class so you need to manually call them from your test class insert(attachment); ApexPages.StandardController standardPageController = new ApexPages.StandardController(testobj); attachPDF att = new attachPDF (...


2

You can transfer the results back to the client, then initiate a download. // client code let action = component.get("c.orderRecord"); action.setParams({ OrderRecId: recordId }); action.setCallback(this, result => { if(result.getState() === 'SUCCESS') { let downloadLink = document.createElement('a'); downloadLink.download = 'example.pdf'; ...


1

Generally speaking, modern web technologies do not allow you to manipulate the end-user's browser experience. Whether or not a "Save As" dialog pops up is a decision set by each user at the browser level. This isn't something that you will be able to reliably handle in JavaScript. Even if you're willing to build an entirely custom HTML/JavaScript &...


1

Using the developer console this generates a System.InvalidParameterValueException: Blob b = Blob.toPdf(''); and the InboundEmail Class documentation says the HTML form may not always be present: htmlBodyThe HTML version of the email, if specified by the sender. so for that case fall back on the plain text: plainTextBody he plain text version of the ...


1

Just adding as answer so that can help others: Base64 input string was not complete and was causing faulty input blob. After fixing it, EncodingUtil.base64Decode worked as expected.


1

You have skipped the extension part in Contentversion. You need to give file title name with extension. cv.title = Sample+'.pdf'; ContentVersion


1

As a sample I used an existing page rendered as PDF and wrote a little method to show how this could be done for you. It is very simple. Just to illustrate i also took some screenshots for you. Page Sample: <apex:page standardController="Account" renderAs="PDF" > <apex:outputField value="{!Account.Id}" /> <apex:outputField value="{!...


1

Yes you can, but you have to create a custom VF page that show the attachment, once you have that VF ready with its controller, you only need to render that page as a PDF. You can achieve that with this at the beginning of your VF page: <apex:page standardController="XXX__c" renderAs="pdf"> I hope it helps....


1

I believe the pdf rendering engine struggles a bit with some CSS styles, which can make normal "modern" positioning using divs and floats inconsistent. I find for this use case its better to strip back the CSS as much as possible, relying more on tables, inline style definitions and good old <font> tags, and less on divs, floats and classes.


1

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 Salesforce to our client. A solution to this problem is to change the controller getter to return a (Base64) String and convert it to a Blob via Javascript, then load ...


1

You will need to do the below Blob k = EncodingUtil.base64Decode(call.Signature__c); Attachment record = new Attachment(ParentId = call.Id, Name=call.name+'.pdf', Body = k,ContentType='application/pdf'); insert record;


1

This does appear to be a limitation, see and vote up the idea on ideaExchange here. I have seen a couple of similar questions with suggested workarounds here and here.


1

You can't use getContentAsPDF nor do any DML statements inside your constructor. You should move that code out in a separate method that you will call explicitly. Either call the method from the action attribute on your VF page or via commandbutton etc.


1

When using passing email.htmlBody as a parameter to Blob.toPdf(), following error is thrown: FATAL_ERROR|System.InvalidParameterValueException: An error occurred while parsing the input string. This happens, because Salesforce system automatically parses tag at the end of email to track the HTML emails. We can see this when we View Source of the email say ...


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