Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder: Plugins & Add-ons:
using print.css for pdf?

 

 


rez
User

Aug 18, 2011, 8:06 PM

Post #1 of 2 (1371 views)
Shortcut
using print.css for pdf? Can't Post

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?


Jason
Staff / Moderator


Aug 19, 2011, 9:41 AM

Post #2 of 2 (1060 views)
Shortcut
Re: [rez] using print.css for pdf? [In reply to] Can't Post

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:


Code
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:


Code
<?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 - Programmer 
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/