Printing content pages

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
idleprocess

Printing content pages

Post by idleprocess »

Hello all,

I'm running 0.11.2 on a hosted box, so I'm not sure specific php or Mysql versions.

Everything is working fine, no errors, though I am trying to do something which is a little over my head.

In a content page I've created, there is an html form.  The form is for printing only.  It does not get passed to and cgi or php script. 

On this page I put the {print} tag.  This does exactly what it's supposed to do, creating a new page without the header, footer or menu elements which prints beautifully.

However, it does not retain what was previously typed into the HTML form.  When I visit the content page, fill out the form and click the {print} tag, the new "print formatted" page is void of the data I just typed and must be typed again.

Is there a way I can retain the HTML form data after clicking the print link?

Please let me know if this isn't clear, I'll try and re-phrase.

Thanks in advance,
Jeremy
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Printing content pages

Post by kermit »

while there may be a way to fix the "print" routine within the code, if you just use the browser to print, it should retain the data in the form fields (it does here on my ff15)... a print media stylesheet will help you strip unwanted junk from the printed page (for newer browser versions).

alternatively, you could use a fill-in-the-form pdf file... the state government here has a lot of their forms online that way. crucial does the same with their tax-exempt forms. quite handy actually.
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
idleprocess

Re: Printing content pages

Post by idleprocess »

kermit wrote:... a print media stylesheet will help you strip unwanted junk from the printed page (for newer browser versions).

alternatively, you could use a fill-in-the-form pdf file... the state government here has a lot of their forms online that way. crucial does the same with their tax-exempt forms. quite handy actually.
I'm very unfamiliar with css in general and wasn't able to find anything in the default stylesheets that looked like the did any "print=media" stuff.  I'm using the "Default CSSMenu Vertical" stylesheet on my pages in cmsms.

Concerning PDF forms, all the solutions I found required Adobe Acrobat 5 or greater.  Are there any opensource FDF solutions I missed?

Thanks again,
Jeremy
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Printing content pages

Post by kermit »

well, i took the combined stylesheets from that template and hacked it up a bit to come up with something that prints header and footer text, and main content. everything else is hidden. i didn't clean it up to get rid of the redundant styles, so it ain't pretty, but it does the job. limited testing here in firefox 1.5 and ie 6.0 as that's the system i'm on at present, but it does print a content page as expected, without chopping anything off (without resorting to 'resize to fit' print setting)..  was working on a default install of 0.12.beta1 and using the one page that uses that particular template as my test.

this stylesheet is attached. just associate it with your template as print for media type (the box underneath the textarea field for editing the stylesheet). the typography & forms parts of the original stylesheets are still in it so you can adjust font sizes and what-not to your preference if you want.

alternatively, setting all the existing stylesheets to media type 'print' and creating a simple print stylesheet that only display:none; on the left-side elements (and other items you don't want printing) should do the trick too. the print stylesheet would simply contain something like the following (plus any styles you wished to apply to text and form elements to pretty it up some):

Code: Select all

div#menu_vert, div#menuwrapper, div#content2, div#menu_horiz, 
div.breadcrumbs, div.flags, div.right49, div.left49, .accessibility { display: none; }

the pdf specs are proprietary but available. that's why there's so many 3rd party pdf utilities out there. i suspect there may be a pdf generation script that can create a fill-in-the-blank pdf file on-the-fly, but i haven't a need for such a thing so i haven't been looking. check the usual locations, hotscripts, sourceforge, etc.

[attachment deleted by admin]
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
idleprocess

Re: Printing content pages

Post by idleprocess »

Kermit,

Thank you very much for taking the time to help out with this.  I never expected this level of help.  Honestly, I was fully prepared for the, "RTFM you f'n n00b" reply.

I am pleasantly surprised and very gracious.  Your reply has inspired me to pick up a beginner book on CSS and further hack up this sheet.

I hope in the future I can provide a noob with as much help as you have and leave them warm and fuzzy too.

Keep up the great work and again, Thank You. :)

Jeremy
jelle

Re: Printing content pages

Post by jelle »

Maybe cmsms should ship with a default media: print stylesheet like this? Or would that provoce of a lot of posts like "my pages print wrong"?
cyberman

Re: Printing content pages

Post by cyberman »

idleprocess wrote: Are there any opensource FDF solutions I missed?
Have you tried the content2pdf module ?
User avatar
kermit
Power Poster
Power Poster
Posts: 693
Joined: Thu Jan 26, 2006 11:46 am

Re: Printing content pages

Post by kermit »

you're welcome folks.

i wish i could contribute with code development or wicked-cool templates.. but i can't (i'm neither a programmer or a dedicated designer); so i do what i can to help when i have time to...



yes, each default template should come with their own print media stylesheet.  if the default templates used the same div id's and classes, it should even be possible to create one that will work with any of them (and with others using the same basic structure):

  site name

  page name

  content

  content1

  content2 (etc..)

  footer

the print link function is still there for those those who don't want/know how to create one for a custom template (or for those naughty tables-based layouts).
eternity (n); 1. infinite time, 2. a seemingly long or endless time, 3. the length of time it takes a frozen pizza to cook when you're starving.
4,930,000,000 (n); 1. a very large number, 2. the approximate world population in 1986 when Microsoft Corp issued its IPO. 3. Microsoft's net profit (USD) for the quarter (3 months) ending 31 March 2007.
CMSMS migration and setup services | Hosting with CMSMS installed and ready to go | PM me for Info
Locked

Return to “CMSMS Core”