Is there any alternative or work around to HTML to PDF convert in apex?

Please help and provide your suggestions.

  • What kind of problem did you get about renderAs="pdf" with apex that dissallow to use it? In visualforce, you can use jsPDF to generate pdf, but in apex -- external services only – kurunve Feb 3 '16 at 8:01
  • I have an HTML code which I need to convert to PDF. I am looking for any alternative. Please find my question here with renderas PDF. This question thread I requested for alternative to that. Please suggest any way possible. salesforce.stackexchange.com/questions/107705/… – Testing_SFDC Feb 3 '16 at 8:04

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 HTML markup as a starting point; not so easy to find "offending element" in your CSS, especially as nice eye-pleasing webpages tend to have lots of markup.

On numerous occasions, I have found it necessary to remove ALL of the CSS and add it back in piecemeal in order to arrive to the destination -- a fully-rendered PDF version of my page.


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 document. But I know Conga has a workflow add-on that allows documents to be generated from a workflow rule in Salesforce, or via outbound message. This would possibly better suit your use case, as it could be massaged to be initiated from Apex. https://www.congasphere.com/products/workflow/C_about_workflow.htm.

I'm sure other products would have similar add-ons available as well.

  • These days Thunderhead is known as Smart Correspond. – Sander de Jong Apr 14 '16 at 7:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.