Hello everybody,
i am so glad to have found such a great tool to generate pdf.
Unfortunately, I can't apply the css style that i want.
I have created in my theme folder a print.tpl.php and a print.css files.
I can change things in mt print.tpl.php file, the output is generated regarding these changes.
But when i modify the css file, nothing happens.
Any idea why?
I have declared in the css path configuration : "%t/print.css"
Anyone to help me??
Thanks a lot

Sophie

Comments

jcnventura’s picture

Status: Active » Postponed (maintainer needs more info)

Hi,

Thanks for finding the module useful.

Regarding your CSS problem, first some info: The PDF is generated from the same output as that of the Web printer-friendly version. Your CSS file should show up in the 'View Source' when browsing the Web version, and your styles should be applied correctly there.

Then, take into account that TCPDF is not capable of using stylesheets (i.e. it simply ignores them) and has very limited support for inline styles. If you want to see the styles in your CSS in the PDF, you must use dompdf. dompdf however is not capable of using Unicode, so all your French accented letters may show up as strange characters. That I know of, there is no perfect solution..

Finally, if the web site is already viewable, I can try to help if you tell me it's URL.

João

SophieG’s picture

Hi Joao,

Thanks for your fast reply.
The module is well displaying my french accented letters so this is quite helpful.
The thing is that also on the web printer friendly version, no css modification is shown, so do you have an idea why?
And the site is not yet online.

Thanks

Sophie

jcnventura’s picture

Hi,

Maybe the browser is not finding the file in the location that the source is telling him to look.

In the header of the page there should be a line like:

<link type='text/css' rel='stylesheet' media='all' href='sites/all/themes/YOUR_THEME/print.css' />

You may have to disable the 'Aggregate and compress CSS files' options in admin/settings/performance.

Can you check if the YOUR_THEME there is correct? Also, see if the file is indeed accessible there.

Are you using the print.css file that came with your theme? If so, the classes are probably wrong. The output of the print module's template uses it's own classes for a lot of stuff, so if you want to change things, you should start with the module's print.css and not from your module's file.

João

jcnventura’s picture

No further comments received in two weeks.

Closing the issue.

jcnventura’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)
monoxide’s picture

Version: 6.x-1.0-rc9 » 6.x-1.0
Status: Closed (fixed) » Active

I'm also having this issue. Neither my theme's or it's base themes CSS is showing up at all in the <link> tags which means that I am unable to theme stuff differently which is a pain because I want to throw some display:none lines around.

jcnventura’s picture

Status: Active » Closed (works as designed)

Hi,

It's actually meant to be like that.. The theme CSS is specifically forbidden from being used in the printer-friendly page. The reason for that is to make sure that the output is as clean as possible. The theme's CSS file is usually 'corrupted' with layout and graphical information that goes against the principle of a printer-friendly page.

If you really want to have use your theme's CSS in the printer-friendly page, you have to specify it in the module settings. However, the module template expects several styles that are module specific, so using your theme's CSS directly will probably result in a very messy output. The recommended method is to modify the provided CSS file to suit your tastes, and not a direct reuse of the theme's CSS.

João

monoxide’s picture

If this is "by design" behaviour, then what is the point of print stylesheets? They are never used...

On the upside, I just figured I could add a <style> tag to the print.tpl.php:

<style>
<?php print file_get_contents("print.css"); ? >
</style>
jcnventura’s picture

On the contrary, stylesheets are used.. Just not the ones that are added by the theme itself (as they aren't usually reliable)

Your hack is equivalent to specifying the print.css in 'admin/settings/print/common'. Which is a lot easier than modifying the template every time you update the module.

João

monoxide’s picture

This is the print.tpl.php in my own theme, not the one inside the module (editing that file would just be silly).

As for the settings page... Oops, didn't notice that. But I still need the custom template for other stuff anyway, so it's not really hurting anything either.