I need a routine for printing out to pre-printed paper forms.

We recently had a programmer install in our office software written in php , and to be used locally through localhost on our pc, mysql, php and apache2.2 all installed, the software is working well, however we have a large supply of pre-printed forms which we want to use up first before using the print direct to ordinary paper, the printout we have just now is printed in a graphic format, and can't find a way to adjust this to our form, we need a routine that will collect data directly from our print.php file and adjust it to suit to our form format.

The programmer said this was not possible, but I am sure there must be a way,

Can anyone help?

8 Years
Discussion Span
Last Post by casper_wang

you will need to change the print form to look like your paper to be printed on, then the code will need to resemble the $print properties for each line to be printed.

Do a google search for php and pdf print styles


Hi thanks for you reply, have checked and maybe in-design may do the job, but collecting the data to be printed may be a problem according to the print script i have, I am a novice when it comes PHP,

Here is the print script that is used just now.

<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>Print Voucher</title>
<link rel="stylesheet" href="style.css" type="text/css">
include_once 'db.php';

if (!isset($db_conn)) {$db_conn = db_open();}


<form id='frmPrint' name='frmPrint' method="get">
<DIV id='divPrint' name='divPrint'></DIV>
var objPrint = document.getElementById("divPrint");
objPrint.innerHTML = window.opener.document.getElementById("divInvoice").innerHTML;

Edited by happygeek: fixed formatting


Give this a try and let us know if it works for you:


Casper, Thanks for the tip, yes it worked like a dream, easy to setup and use, at least we can print our vouchers manually for now, using our database is a problem for at the moment, but I am sure we will be able to in a few days when our programmer comes back and give us the correct fields for input, possibly need to do a double function, first transferring to msaccess db so as to use the obdc function in the software.

Best regards


Great, I'm glad you got a work around for the time being. If you need any other assistance don't hesitate to ask.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.