Printing CSS-formattied articles

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Locked
saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Printing CSS-formattied articles

Post by saviourdebono » Tue Dec 02, 2008 10:27 pm

Hello !

i am formatting tables with my own css and works OK on the screen . When i try to print from the front-end my print css is ignored. I tried various experiments (i) seperating the screen css from the print css into different files; (ii) embedding the print css in the index.php but nothing seem to work.

I wonder if Joomla allows printing own-formatted articles at all.

Any body has an idea ?

Cheers.
Saviour / Germany

User avatar
a.radtke
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 221
Joined: Thu Aug 18, 2005 8:01 am
Location: Germany Bonn
Contact:

Re: Printing CSS-formattied articles

Post by a.radtke » Thu Jan 08, 2009 6:32 pm

Hi

can you send a link?

Bye Angie
ausdrucks|Stark
Büro für Kommunikation Angie Radtke
http://www.der-auftritt.de
Blog: http://www.der-auftritt.de/wissen.html

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Fri Jan 09, 2009 12:32 am

Hello,

thank you for your attention. Here is the link:

http://www.atlantis-travel.com/index.ph ... &Itemid=31

I would greatly appreciate your expert advice.

Rgds
Saviour

User avatar
a.radtke
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 221
Joined: Thu Aug 18, 2005 8:01 am
Location: Germany Bonn
Contact:

Re: Printing CSS-formattied articles

Post by a.radtke » Fri Jan 09, 2009 6:46 am

Hi

I couldn't find a CSS width media="print" in your source.
How did you add the Print CSS in the index.php of your template?

And don't forget that all Browsers didn't print background-colors and background-images per default.
If you want to print that, you should configure your browser.

Bye Angie
ausdrucks|Stark
Büro für Kommunikation Angie Radtke
http://www.der-auftritt.de
Blog: http://www.der-auftritt.de/wissen.html

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Fri Jan 09, 2009 1:01 pm

Hi,

i am using a component called "css2switch" (http://www.mediahof.de) which allows me to
target menu-items with my own stylesheet. The css file which i am using is called "template_atl_tables.css" .

Then i changed the styles into print-styles (removing color; change px into pt) and embedded them into the template/index.php .

If you would like to have a look under the hood you will find the print-css on line 143 in the index.php (admin/admin).

In the meantime i experimented with inline-styles . This seems to work ! HOWEVER, i dont think that you would recommend inline-styling .

Kind regards
Saviour

User avatar
a.radtke
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 221
Joined: Thu Aug 18, 2005 8:01 am
Location: Germany Bonn
Contact:

Re: Printing CSS-formattied articles

Post by a.radtke » Fri Jan 09, 2009 3:10 pm

Hi

that's the wrong way .

You should add to an URL like:

<link rel="stylesheet" href="/templates/yours/css/print.css" type="text/css" media="print" />

Bye Angie
ausdrucks|Stark
Büro für Kommunikation Angie Radtke
http://www.der-auftritt.de
Blog: http://www.der-auftritt.de/wissen.html

biber
Joomla! Apprentice
Joomla! Apprentice
Posts: 8
Joined: Mon Apr 07, 2008 10:47 pm

Re: Printing CSS-formattied articles

Post by biber » Fri Jan 09, 2009 3:29 pm

good tutorial thank you

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Sun Jan 11, 2009 1:47 pm

Hello ,

i wish i could tell you Hurray Hurray !

I made the link in the index file the way
you corrected but it does not format the printed document.

<link rel="stylesheet" href="/templates/jsn_epic_pro/css/template_atl_tables_print.css" type="text/css" media="print" />

I wonder whether this is a Joomla limitation or a template bug !

I made a dummy article with inline-styling and... it works perfectly
on the sreen and prints the document the way i want it to be printed .

http://www.atlantis-travel.com / Resieziele / oman / dummy

However, is this the correct practise ?

Krgds
SAviour

User avatar
a.radtke
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 221
Joined: Thu Aug 18, 2005 8:01 am
Location: Germany Bonn
Contact:

Re: Printing CSS-formattied articles

Post by a.radtke » Sun Jan 11, 2009 2:08 pm

Hi,

The reason is definitly not Joomla.
You have a lot of CSS files. And I think you should take a look at the CSS - inheritance rules.

Bye Angie
ausdrucks|Stark
Büro für Kommunikation Angie Radtke
http://www.der-auftritt.de
Blog: http://www.der-auftritt.de/wissen.html

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Fri Jan 16, 2009 4:27 pm

Hello !

i will surely check my CSS .

I d like to thank you for your valuable advise and help and
even for the service you are doing the Joomla! community.

Thank you
Saviour

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

Re: Printing CSS-formattied articles

Post by emeyer » Sat Apr 04, 2009 9:37 am

I am having the same problem. I did the stylesheet at the bottom of the head section and it is loading properly, but still when pressing the print button it ignores it and uses some other style sheet instead.

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Sat Apr 04, 2009 9:43 pm

The only bullet-proof way is to format your html-inline !

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

Re: Printing CSS-formattied articles

Post by emeyer » Tue Apr 07, 2009 5:06 am

Now this is not rocket science. There seems to be two print separate problems: printing from the browser's print button, and printing with the Joomla built-in print button on articles. They behave differently, but neither behave as expected.

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Tue Apr 07, 2009 7:50 am

I almost lost my insanity on this issue. Try formatting your html in-line and
you ll see what i mean.

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

Re: Printing CSS-formattied articles

Post by emeyer » Tue Apr 07, 2009 5:06 pm

WEll I found it is partly controlled by template overrides, there are php statements if!(print){} in the content.php and other files. It seems the only realy way to differentiate the outputs.

Losing your insanity would be a good thing, that would make you sane again.

saviourdebono
Joomla! Apprentice
Joomla! Apprentice
Posts: 15
Joined: Fri Nov 07, 2008 10:00 pm

Re: Printing CSS-formattied articles

Post by saviourdebono » Tue Apr 07, 2009 10:06 pm

Thks for correcting my english ...

Luckily i am still sane again.

Jokes apart, if you are easy with scripting then you may have found the solution with overrides.

I dont know what your needs are. But there may be other solutions. I found
a plug-in which allows me to embed an article within any article. So i would
format a table, save it as an article then call it in any other article.

The effect is like using code-snippets in dreamweaver.

You may wish to have a look at this plug-in. It is very easy to use.

http://extensions.joomla.org/extensions ... 09/details

Good Luck !

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

Re: Printing CSS-formattied articles

Post by emeyer » Tue Apr 07, 2009 11:10 pm

And I found another solution. The Beez template doesn't print pagination at the bottom. Copying the beez template html/pagination.php into one's own template removes the pagination on page footers in the print window.

The "print" and "email" icons show up in the browser preview window, but not in the popup print window. So, making some progress.

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

Re: Printing CSS-formattied articles

Post by emeyer » Wed Apr 08, 2009 9:03 am

Fixed. I made template overrides and added my own classes for print and email. Thanks for all the help.

jayflower
Joomla! Apprentice
Joomla! Apprentice
Posts: 44
Joined: Fri May 02, 2008 7:02 pm
Location: Argentina

Re: Printing CSS-formattied articles

Post by jayflower » Fri Apr 17, 2009 7:24 pm

Thanks ! many ! I was wondering how to make the print layout better.
Regards
Florencia
Florencia

emeyer
Joomla! Explorer
Joomla! Explorer
Posts: 352
Joined: Thu Sep 29, 2005 2:37 am

Re: Printing CSS-formattied articles

Post by emeyer » Wed Apr 01, 2015 12:04 am

An update on this isue, as of March 2015, mostly including a print stylesheet will work.

However Chrome currently ignores it for the Joomla print button, which has been remarked on a number of times for about a year, but there seems no plan to change Chrome's behavior.

As Chrome is currently the most popular browser, the best option is not to publish any print links or icons on articles, but to let people print from the browser menu instead.

[edit] An alternative should be to use javscript window.print(), and W3C reports all browsers support it, but the method has been notoriously unreliable in the past decade, so I would not go as far as suggesting a code revision to use it instead. A better option, in my opinion, would be to suggest removing the print funciton altogether from the Joomla default templates, because even if the javascript method works now,k it probably wont in the future.


Locked

Return to “Templates for Joomla! 1.5”