1

I need to render pdf page with content from object. To do so I put <apex:detail> element in page and it is working, but its showing other elements from page layout that I don't need in pdf. I tried to apply styles, but I noticed that they working only if I indicate class explicitly. For example:

.pbSubheader {
    display: none;
}

this style will hide all elements with class .pbSubheader, but if I won't to hide elements with more complicated logic then this styles are ignored, for example:

.pbBody .pbSubsection:not(:last-child) {
    display: none;
    visibility: hidden;
}

this style will not work. How can I achive this?

2
  • Add an "id" to your tag and use CSS selectors when applying your style.
    – Jac Uy
    Commented Jun 1, 2017 at 8:53
  • We don't have access to what <apex:detail> will generate Commented Jun 1, 2017 at 9:12

1 Answer 1

0

You can try to set some variable to true, only when you render it as pdf, and use that variable in rendered attribute of those elements which you want to hide.

4
  • I'm not sure I understand it. We don't have access to what <apex:detail> will generate. Commented Jun 1, 2017 at 8:47
  • Ohkk.. then instead of only main class, you will need to check exact hierarchy of classes being used on those elements which you want hide. (Parent to child elements) Commented Jun 1, 2017 at 8:54
  • But I need to use additional conditions like :last-child, :first-child Commented Jun 1, 2017 at 9:11
  • 1
    @user2452483 the css selectors you are using like :first-child and :last-child are from css3 and salesforce pdf engine does not support css3. So you should come up with css2.1 selectors for the elements you are trying to hide.
    – javanoob
    Commented Jun 1, 2017 at 12:43

You must log in to answer this question.

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