2

I'm using escape attribute to have my exact design to be printed on PDF. BUt, i can't able apply styling for this output text:

<apex:outputText value="{!tic}" escape="false" styleClass="h2" >
</apex:outputText> 

with Style:

h2 { margin: 0; font-size: 1.5em; font-weight: normal; color:green;}

and tic contains something like that:

<table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 99%;" width="99%">
    <tbody>
        <tr>
            <td colspan="1" rowspan="1"> Event Name: {@Ename}</td>
        </tr>
        <tr>
            <td colspan="1" rowspan="1"> Registrant Name: {@FirstName}{@LastName}</td>
        </tr>
    </tbody>
</table> 
<br>
1
  • so what do you get? Is there the table? is there the width: 99%? Are you waiting for the font of the td's to become green (as of you h2 style)? What do you get (Screenshot please!) and what exactly do you expect? Btw. the td's will never get green this way...
    – Uwe Heim
    Feb 6, 2015 at 12:59

2 Answers 2

0

YOUR SITUATION

It doesn't make much sense to apply styleClass="h2" and to use {!tic} with complex table-markup and style within that.

I don't think you want the table inside the caption, or do you?

GENERAL CONSIDERATIONS

Several people here say that the underlying mechanism salesforce to create the PDF is Flying Saucer and it's capabilities are limited.

As a rule of thumb it should support most of the CSS 2.1 features plus some features for paged media.

Unless you are providing some code, it's hard to tell you more than that.

UPDATE:

5
  • Uwe: <apex:outputText value="{!tic}" escape="false" styleClass="h2" ></apex:outputText> Style: h2 { margin: 0; font-size: 1.5em; font-weight: normal; color:green;}.. But, i can't see any effect of the style. I have place my outputtext in Html also but no luck worked..
    – Rv1
    Feb 6, 2015 at 12:15
  • All of this tells us nothing about the INSIDE of {!tic} and the definition of h2. So if it would be simple, like tic='123' and h2 is something like h2 { font-size: 20px } I see no reason why it shouldn't work. BUT if you put nice stuff inside tic, containing more CSS or your h2 has some CSS 3.0, how should we tell? So please be a bit more precisely and tell the us the long and not the short story.
    – Uwe Heim
    Feb 6, 2015 at 12:21
  • Yes, i should be more specific. I'm getting a design code in the tic. By making escape false, it's showing in design format.. Here, is the example output of tic: <table align="center" border="0" cellpadding="0" cellspacing="0" style="width: 99%;" width="99%"><tbody><tr><td colspan="1" rowspan="1"> Event Name: {@Ename}</td></tr><tr><td colspan="1" rowspan="1"> Registrant Name: {@FirstName}{@LastName}</td></tr></tbody></table> <br> Here, i want to customize my design more specific.
    – Rv1
    Feb 6, 2015 at 12:25
  • can you please update you question with that code and format it the right way? Putting it in a comment makes it more than unreadable. I'll then have a look on it.
    – Uwe Heim
    Feb 6, 2015 at 12:46
  • wait I'll do it for you. It seems you are not familiar with the markdown used here... please refer to the help for the next time.
    – Uwe Heim
    Feb 6, 2015 at 12:54
0

I would not expect this to work. By doing this, you're essentially creating active content on your page which renderAS=PDF does not support. The render engine will essentially try to layout the structure of the page before it begins to render the content. If you want to do this type of thing, you probably need to assemble it first inside your controller and pass all of it to your page as text for output.

Now if you were to create a custom styleClass that included all of this styling information, then used something like {!tic} (Note: if it needs to include additional <apex:output texts>, I doubt this will work) followed by a loop that contained {en}, {fn} and {ln} to hold {@Ename},{@FirstName} and {@LastName} (you'd need to play with the implementation of this), then I think it would be more likely to work as it would be less likely to appear as active content to the render engine.

You must log in to answer this question.

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