This is an archived forum post. The information may be outdated. Contact us if you have any questions.

Being selective about what content goes into the PDF

Andynashmobile wrote on 2014-10-29:
Hi,
Loving the simplicity of PDF crowd.
Just wanted to know whether it can be configured to show/hide content based on HTML markup such as classes?
We control desktop and mobile view from a single page, using a hidefrommobile and hidefromdesktop class.
At the moment using PDF crowd does not distinguish and creates a PDF with all the code (often duplicating content in the file as a result - displaying both the desktop and mobile variants).

Do I have any options currently?
Are there any plans for development in the future along these kinds of lines?

Cheers,

Andy
support wrote on 2014-10-30:
Hello,

You can use the @media rule for this purpose.

CSS
@media print {
  .screen-only { display:none }
}
@media screen {
  .pdf-only { display:none }
}


HTML
<p class="screen-only">This won't be printed</p>
<p class="pdf-only">This won't be rendered in the browser, only in PDF</p>


API
// use the print media type, default is screen
$client->usePrintMedia(True);
Andynashmobile wrote on 2014-10-31:
Many thanks!