Re: Different styles for screen and print

Yan Seiner <[email protected]>
Newsgroups gmane.comp.python.reportlab.user,gmane.org.wikimedia.mediawiki
Message-ID <[email protected]>
On 11/29/2013 07:57 AM, Yan Seiner wrote:
> I have a mediawiki template for a photo "gallery" - basically 2 images 
> sized to span the width of the page.  I am using mwlib / rl reports to 
> generate pdfs from the wiki.
>
> I need to have one format / size of the images for screen display and 
> one for the pdf to make it appear correctly.
>
> I have tried using various combinations of <div media="print" 
> display="none"> and so on and it either displays in both screen and 
> reports or neither.
>
> Is anyone using mwlib / reportlab to create pdfs with different screen 
> and report formatting?  How do I tell reportlab to ignore certain 
> sections?

I've made some progress but I'm still struggling with reportlab.

For mediawiki, the following gives the results I want, but reportlab 
prints both paragraphs:

Test page:

== Print ==

<div style="media:print" class="ys_print">
Lorem ipsum....
</div>

== Screen ==
<div style="media:screen" class="ys_screen">
Lorem ipsum....
</div>

Common.css:

@media screen {
   div.ys_print {
     display: none;
     }
   }

Print.css:

@media print {
   div.ys_screen {
     display: none;
     }
   }

How do I get reportlab to respect the media and display css?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.