function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Trail headTrail head 

Can we convert Word file to Pdf using apex

Hi ,
want to send an email with Pdf attachement using Single Email Message.
for generating pdf either one is ok.
  1. i have Doc file and want to convert this doc to and pdf and need to sent an email.if we blob.toPdf then css is missing.
2. Am trying to show the doc file in Vf page .Int this case css is missing.
 want to send the same doc files as pdf attachment.
Can any one please help me on this.Thanks in advance
Rohit Singh 269Rohit Singh 269
Yes, you can convert Word files to Pdf file format with the help of Adobe Reader.
Trail headTrail head
Can you share the Sample the Code for this.
SwethaSwetha (Salesforce Developers) 
HI Trailhead,
As per the posts from the past like  https://salesforce.stackexchange.com/questions/86127/css-not-included-in-pdf-attachment
https://salesforce.stackexchange.com/questions/310811/blob-to-pdf-not-retaining-html-css
https://developer.salesforce.com/forums/?id=906F000000099HBIAY

 Blob.toPDF() has several bugs and CSS is not respected when using it and looks like there is no workaround for it too. 

Copying text from the above link:
"There is no way around the CSS 3 issue until SF updates the render engine they use. Rendering a PDF is like printing a file to a Postscript Printer. If you don't have the right "drivers", it's not going to print anything but garbage. At present, SF uses the Flying Saucer Render engine. Until it gets updated or they choose another one, nothing you can do. "

If this information helps, please mark the answer as best.Thank you