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
AAlex11AAlex11 

Problem rendering pdf in visualforce page

Hi, 
I'm developing a visualforce page with two columns layout.
The VFpage works fine but when I try to render my page as pdf CSS style is ignored.
this is my code:
<apex:page >
<center> <b> My title </b> </center>
<br> </br>

       <head>
<style type="text/css">
.newspaper {
    -webkit-column-count: 2;
    -moz-column-count: 2;
    column-count: 2;

    -webkit-column-gap: 40px;
    -moz-column-gap: 40px;
    column-gap: 40px;

    
}
</style>
</head>
<span>


<div class="newspaper">

My content

</div>
</apex:page>

Why is ignored CSS style?
Anyone could help me?
Thanks
pconpcon
You need to apply the style for print.  Take a look at these blog posts [1] [2] [3] [4] for more info.
 
<apex:page renderAs="pdf">
    <center>
        <b>My title</b>
    </center>
    <br/>
    <head>
        <style type="text/css" media="print">
            .newspaper {
                -webkit-column-count: 2;
                -moz-column-count: 2;
                column-count: 2;

                -webkit-column-gap: 40px;
                -moz-column-gap: 40px;
                column-gap: 40px;
            }
        </style>
    </head>
    <div class="newspaper">
        My content
    </div>
</apex:page>

You'll also want to look at the applyHeadTag and applyBodyTag attributes for apex:page so that you don't have to <head> tags in your output.

[1] http://blog.deadlypenguin.com/blog/2016/04/04/pdf-headers-footers-visualforce/
[2] http://blog.deadlypenguin.com/blog/2016/04/18/pdf-attachment-visualforce/
[3] http://blog.deadlypenguin.com/blog/2016/04/25/field-sets-dynamic-visualforce/
[4] http://blog.deadlypenguin.com/blog/2016/05/09/watermarking-pdfs-visualforce/
AAlex11AAlex11
Thanks for your help pcon, but unfortunately  the problem is still there, with my css style I create a two columns -layout but the render  is still ignoring CSS style.
Any other suggestion?
pconpcon
I think you'll want to reproduce your page with the applyBodyTag and applyHeadTag to false.  Linked CSS files (such as those provided by the default head tags) do not work in PDF views.