NetTalk Central

Author Topic: Printing  (Read 4302 times)

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Printing
« on: September 18, 2008, 06:51:25 PM »
Is there a way to print a report directly to a printer rather than to a pdf file first?

I need to add check printing to my app so not only do I need it to print direct but also tell it how many carbon copies to print.

Any idea's?

Thanks,

Kevin

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Printing
« Reply #1 on: September 18, 2008, 07:40:15 PM »
What I do for this Kevin is to send it to an HTML page (without headers and footers). You can give the user the option of a button or simple, unobtrusive link, like

<a href="javascript:print()" alt="Click here to print page"><img src="/images/printbutton5.jpg" border="0" /></a>

The problem with this method is controlling the formatting to the printer. I don't know of a way of sending the PDF directly to the printer without preview though.
Mike Grigsby
Credify Systems
Central Oregon, USA

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Printing
« Reply #2 on: September 18, 2008, 08:25:37 PM »
Hi Mike,

thanks for your suggestion. I use L&L so I can easily just create the report as HTML instead of PDF.

I guess in a perfect world what would be nice is to create the temp html page (report) and as soon as it is ready, either display a button on the original html page to be able to print the temp html page or just print it and dispose of the page when it is ready.

Controlling the number of copies could be more difficult so I guess I just do this with the html doc (physically create say 3 copies of each page when creating the html doc) before printing.

Cheers,

Kev


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11251
    • View Profile
Re: Printing
« Reply #3 on: September 18, 2008, 11:37:00 PM »
Hi Kevin,

It's the browse that does the printing, so I don't think there's any way to print "something the user can't see". In other words, if you want it to print, you have to send it to the browser first.

PDF gives you the most control over the end result because it handles page-layout and pagination. On the other hand, it doesn't "print automatically".

If you're sending them a nice clean HTML page then you can print it automatically when it arrives in the browser. But this approach also prints "extra stuff" on the page (typically the page name, date & time, page number, and so on.)

To make a Print dialog pop up as soon as the page in in the browser, add the following script somewhere on the page... (The user still has to click on "ok" though.)

<script type="text/javascript" defer="defer">print();</script>

Now for the 3 copies bit. This gets a bit tricky. when the dialog pops up they can set the copies to 3 - but that may not be ideal. So what you want to do then is send the HTML page containing 3 identical copies of what you want to print.

Between the 3 copies you add
<DIV style="page-break-after:always"></DIV>
which causes the pagination to happen.

Cheers
Bruce


kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Printing
« Reply #4 on: September 18, 2008, 11:59:05 PM »
I think that would work. Could I put a return URL that it would automatically return to after it starts printing?

The other option but not sure if you can do on the web but you can do in windows is to automatically print a pdf without previewing it.

Cheers,

Kev