using print.css for pdf?
2 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: August 19, 2011 (RSS)
By rez - August 18, 2011
I thought I read that the PDF plug follows print.css rules. I have my header, navigation etc hidden in a print.css file that looks fine printed but everything is still showing in my PDF file.
Is there a way to hide things in the PDF's?
Is there a way to hide things in the PDF's?
Re: [rez] using print.css for pdf?
By Jason - August 19, 2011
Hi,
the createPDF plugin will render the page as a PDF exactly how it would look if viewed through a browser. If you need to load a different CSS file when creating the PDF you have a couple of options. You could create a separate template that is used for the PDF. Another option would be to pass a variable to in your URL showing that this would be a PDF. For example:
You can then use the presence of this pdf variable to determine which css file to load:
the createPDF plugin will render the page as a PDF exactly how it would look if viewed through a browser. If you need to load a different CSS file when creating the PDF you have a couple of options. You could create a separate template that is used for the PDF. Another option would be to pass a variable to in your URL showing that this would be a PDF. For example:
www.mysite.com/detailPage.php?num=6&pdf=1
You can then use the presence of this pdf variable to determine which css file to load:
<?php if (@$_REQUEST['pdf'] ==1): ?>
<link rel="stylesheet" type="text/css" media="screen" href="print.css" />
<?php else: ?>
<link rel="stylesheet" type="text/css" media="screen" href="screen.css" />
<?php endif?>
Hope this helps
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/
Jason Sauchuk - Project Manager
interactivetools.com
Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/