FORUMS: list search recent posts

Print to PDF from HTML live

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Richard WilliamsPrint to PDF from HTML live
by on Apr 26, 2010 at 4:17:00 pm

Im creating a ticket control pannel for a client, and they want to print off tickets acording to the recordset query i have set up.

I have used PHP and a command, window.print()

This is ok, but the problem is that it will then print the header and footer on the pages, such as page no x of y pages in the header and the url in the footer.
As far as i can tell, there is no way to control the header and footer from the PHP or HTML code, so im thinking of putting the onclick event of my button to take the dynamic text into a PDF for printing.

Do you know of an example of code on how to do this, or even just give me a clue on what to google for, my searches are not coming up with the right type of print to PDF that i would hope for?

To sumarise...

i have a master page, and the detail page is a repeated region of a delivery note. I have used pagebreak rule in the css, so each ticket is printed out on seperate pages.
I wish the detail page to be PDF now instead of HTML/PHP

Thanks guys.

Richard


Return to posts index

cowcowcowcowcow
Curtis ThompsonRe: Print to PDF from HTML live
by on Apr 26, 2010 at 4:20:52 pm

hello...

never used it, but this might be a good place to start:

http://www.fpdf.org/

sitruc


Return to posts index

Fernando MolRe: Print to PDF from HTML live
by on Apr 26, 2010 at 5:20:06 pm

That's a good tool, Curtis.

Also, if I'm understanding it right, this could be solved adding a CSS for print. In that CSS you can hide the elements you don't want to print (just add a "hide" class and define it as display: none;), and you can also change the background color, layout, fonts, etc.

You'll just need to add the media type in the link for the external CSS and it will be visible ONLY when printing.

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

For testing, you can change the preview in DW going to the menu
>View >Style Rendering >Print

I hope this helps

*Always share a link to your site and rate the posts. This is a free service for you and for us.


Return to posts index


Richard WilliamsRe: Print to PDF from HTML live
by on Apr 26, 2010 at 6:15:00 pm

Taks guys... this has been doing my head in. Ill give this a go tonight with the link you provided thanks Curtis.

Fernando... i cant use hidden fields, its the header and footer info that the browser puts on the page, not the HTML.

For example, if you print an HTML from IE, it puts the document title and page number in the header, and then it puts the web address in the footer.

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index


Richard WilliamsRe: Print to PDF from HTML live
by on Apr 26, 2010 at 6:29:59 pm

HANG ON...

If i just switch it off on the page setup from the browser, it holds that setting off and doesnt display said settings in header or footer... DOH! lol... That was easy... Why didnt i think of that last night!!!

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Curtis ThompsonRe: Print to PDF from HTML live
by on Apr 26, 2010 at 6:32:40 pm

hello...

well - you mean that you personally, the user, can turn that stuff off in your local browser, ya? if so, that will work for you, but you then have to tell each user to do that, and that's not something many (if any) will do... :-/

sitruc


Return to posts index


Richard WilliamsRe: Print to PDF from HTML live
by on Apr 26, 2010 at 8:53:01 pm

Yes, i realise that, but there is only one user, it is for an admin area so client can print off ticket invoices after orders are taken online, so only one person on one computer going to use it so itll be fine for her for now... least it will work.

:o)

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Curtis ThompsonRe: Print to PDF from HTML live
by on Apr 26, 2010 at 9:09:29 pm

ahh - ya. that would work then - didn't suggest that as i figured it wasn't a single-user mode.... :-)



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]