Is there any alternative or work around to HTML to PDF convert in apex?
Please help and provide your suggestions.
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.
Sign up to join this communityIs there any alternative or work around to HTML to PDF convert in apex?
Please help and provide your suggestions.
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.