• Jon McDermott
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 4
    Replies

I have a VF page that I am rendering in PDF where part of the content is an Ordered List, with some embedded Unordered Lists. When I use the renderas="pdf" argument in my apex:page line the embedded lists do not render correctly. If I take out the renderas="pdf" argument in the apex:page line, the resulting HTML page does render correctly.

 

Here is an example VF page:

 

<apex:page standardController="Opportunity" sidebar="false"
    showheader="false" cache="true" renderas="pdf">
<HTML>
<head></head>
<body>
    <P>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rutrum est in elit volutpat 
    lacinia. Integer scelerisque enim eu quam tempor in sagittis urna consequat. Morbi euismod, 
    quam nec malesuada lacinia, erat elit varius metus, in vehicula nisl nibh non leo.</P>
    <OL>
        <LI>Curabitur vel euismod est. Nunc id ligula dui, at mollis risus:
        <UL>
            <LI>Morbi ultrices feugiat leo, ut luctus augue lobortis eget;</LI>
            <LI>Vestibulum dignissim risus at turpis pretium ut facilisis dolor bibendum.</LI>
        </UL>
        </LI>
        <LI>IAliquam aliquam porta tellus, sit amet tempor ligula lobortis vitae:
        <UL>
            <LI>Nunc suscipit dui vitae dui sagittis non scelerisque sem ultrices;</LI>
            <LI>Fusce sit amet lorem sed metus tincidunt tristique;</LI>
            <LI>Cras rutrum enim ac ipsum ullamcorper scelerisque</LI>
        </UL>
        </LI>
        <LI>Aenean eu neque mattis nibh viverra facilisis viverra ac sapien. Integer 
            sed mauris at nibh volutpat varius ac volutpat dolor.</LI>
        <LI>Vestibulum euismod ipsum sed eros faucibus laoreet arius diam sit amet 
             metus venenatis nec imperdiet nibh dapibus.</LI>
    </OL>
    <P>Aliquam luctus turpis non lectus rhoncus non hendrerit eros facilisis. Nulla facilisi. 
    Nunc blandit tortor id nisl egestas semper tristique nunc cursus. Donec vulputate venenatis mi, 
    vitae pretium nisl dapibus eu. Sed purus nisi, malesuada in imperdiet ac, rhoncus sit amet velit. 
    Sed a quam nec lorem consectetur bibendum ut quis augue. Mauris et nulla eget purus sodales 
    tempor vitae at diam.</P> 
</body>
</html> 
</apex:page>

 The rendered PDF page shows as follows:

 

 

 

 

Whereas if I remove the renderas="pdf" in the apex:page line and let the page render as HTML, I get the following result:

 

 

 

Seems like the PDF render within VF is not producing reasonable output results for this example.

 

Has anyone else seen this type of issue?  Is there any way to weork around the problem?

I have a VF page that I am rendering in PDF where part of the content is an Ordered List, with some embedded Unordered Lists. When I use the renderas="pdf" argument in my apex:page line the embedded lists do not render correctly. If I take out the renderas="pdf" argument in the apex:page line, the resulting HTML page does render correctly.

 

Here is an example VF page:

 

<apex:page standardController="Opportunity" sidebar="false"
    showheader="false" cache="true" renderas="pdf">
<HTML>
<head></head>
<body>
    <P>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam rutrum est in elit volutpat 
    lacinia. Integer scelerisque enim eu quam tempor in sagittis urna consequat. Morbi euismod, 
    quam nec malesuada lacinia, erat elit varius metus, in vehicula nisl nibh non leo.</P>
    <OL>
        <LI>Curabitur vel euismod est. Nunc id ligula dui, at mollis risus:
        <UL>
            <LI>Morbi ultrices feugiat leo, ut luctus augue lobortis eget;</LI>
            <LI>Vestibulum dignissim risus at turpis pretium ut facilisis dolor bibendum.</LI>
        </UL>
        </LI>
        <LI>IAliquam aliquam porta tellus, sit amet tempor ligula lobortis vitae:
        <UL>
            <LI>Nunc suscipit dui vitae dui sagittis non scelerisque sem ultrices;</LI>
            <LI>Fusce sit amet lorem sed metus tincidunt tristique;</LI>
            <LI>Cras rutrum enim ac ipsum ullamcorper scelerisque</LI>
        </UL>
        </LI>
        <LI>Aenean eu neque mattis nibh viverra facilisis viverra ac sapien. Integer 
            sed mauris at nibh volutpat varius ac volutpat dolor.</LI>
        <LI>Vestibulum euismod ipsum sed eros faucibus laoreet arius diam sit amet 
             metus venenatis nec imperdiet nibh dapibus.</LI>
    </OL>
    <P>Aliquam luctus turpis non lectus rhoncus non hendrerit eros facilisis. Nulla facilisi. 
    Nunc blandit tortor id nisl egestas semper tristique nunc cursus. Donec vulputate venenatis mi, 
    vitae pretium nisl dapibus eu. Sed purus nisi, malesuada in imperdiet ac, rhoncus sit amet velit. 
    Sed a quam nec lorem consectetur bibendum ut quis augue. Mauris et nulla eget purus sodales 
    tempor vitae at diam.</P> 
</body>
</html> 
</apex:page>

 The rendered PDF page shows as follows:

 

 

 

 

Whereas if I remove the renderas="pdf" in the apex:page line and let the page render as HTML, I get the following result:

 

 

 

Seems like the PDF render within VF is not producing reasonable output results for this example.

 

Has anyone else seen this type of issue?  Is there any way to weork around the problem?

After a lot of persistence I finally was able to get repeating header and footers when rendering a Visualforce page as a PDF. The key to this is the page2PDF support of CSS3. 

 

Here is the css I came up with:

 

<style type="text/css">

@page {

@top-center {

content: element(header);

}

}

div.header {

padding: 10px;

position: running(header);

}

</style>

 

In the visualforce page I have the header setup as a div with the class name "header" the position running command pulls the content in my div and repeats it at the top of every page. The key for some reason is to put your header and footer divs at the top before you put your content on the page.

 

Here is my page

 

<apex:page renderAs="pdf">

<head>

<style type="text/css" media="print">

@page {

@top-center {

content: element(header);

}

@bottom-left {

  content: element(footer);

}

}

 

div.header {

padding: 10px;

position: running(header);

}

div.footer {

display: block;

padding: 5px;

position: running(footer);

}

 

.pagenumber:before {

content: counter(page);

}

.pagecount:before {

content: counter(pages);

}

</style>

</head>

 

<div class="header">

<div>My Header Text</div>

</div>

 

<div class="footer">

<div>Page <span class="pagenumber"/> of <span class="pagecount"/></div>

</div>

 

<div class="content">

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum nec nulla turpis. Suspendisse eget risus sit amet lectus ornare varius. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean nec urna purus, adipiscing accumsan massa. Nullam in justo nulla, sed placerat mauris. In ut nunc eget libero posuere luctus. Donec vulputate sollicitudin ultrices. Nulla facilisi. Mauris in sapien arcu. Phasellus sit amet quam non mi ornare tincidunt ac quis lectus.</p>

</div>

</apex:page>

 

I cut the content text short for the purpose of this post. I am sure it will just take some more playing around.

 

Hope this helps someone avoid some late nights like I spent trying to figure this out. :smileyhappy:

 

 

Message Edited by JohnDS on 03-10-2010 07:34 PM

I have installed this application and when I try to attache a pdf to the quote, I get 5 blank files with the appropriate quote number. Since I no absolutely nothing about programming, I wonder if there are any application notes or suggested changes that need to be made to get the application operational for actually creating the pdf?

 

Thanks