2

I am using the below css . this works fine in html but when i do renderAsPdf this doesnt work.

p {
        -webkit-columns: 2; 
              -webkit-column-gap: 5mm;
             -webkit-column-rule: dotted green 1mm;
    }

1 Answer 1

2

I've found that styles declared in external resources or inside tags don't always get picked up correctly by the PDF rendering engine. HTML tables are particularly flaky in this regard, so I typically end up using inline styles.

However, in this case I don't think that's the issue. The style that you are defining relies on the webkit attributes, which are styles specific to the webkit rendering engine (used by Safari and previously by Chrome). As the Salesforce PDF rendering engine doesn't use webkit, those attributes will be ignored. The only way I've found to get these type of extended CSS attributes into PDF is to load the page in chrome and then print to PDF.

6
  • Hi Bob. it doesnt work in print as well.. My requirement is that I need to render a vf page as pdf . And there is dynamic content in the vf page.so i want it to break the content based on the columns defined in the CSS . I am using chrome engine. without webkit it doesnt work in vf page as well Jul 22, 2014 at 11:03
  • I reckon you'll have to use an HTML table for this - the PDF rendering engine in Visualforce is pretty basic. Jul 22, 2014 at 11:14
  • In that case i wont be able to decide when the page is about to break and I have to move the content to the 2nd column and not to 2nd page. because its dynamically generated content Jul 22, 2014 at 11:19
  • Unfortunately, stating your requirements doesn't change the capabilities of the underlying tool, you have to work with what the PDF engine can do. Jul 22, 2014 at 11:20
  • Any suggestions in using HTML table to determine the size of the PDF page so that as soon as that height is reached i can shift the content to the next column Jul 22, 2014 at 11:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .