trouble printing multiple documents

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
kirilisa
Forum Commoner
Posts: 28
Joined: Fri Dec 05, 2003 4:41 pm

trouble printing multiple documents

Post by kirilisa »

Hello, I have a bit of a problem with a css layout that I have.

This layout is for invoices. Therefore, most of the layout is done with absolutely positioned divs (certain parts of the invoice must line up with envelope windows, among other things, and therefore need exact position)

I have my layout done and it works just fine. The problem comes when I want to print it.

The person I created this for usually needs to print dozens of invoices at a time. The way I used to do it before the envelope window came into being, using PHP, given some array of invoices and invoice information, was to create one large document of all the invoices, seperated by page breaks.

i.e.

Code: Select all

for ($i=0; $i<count($invoices); $i++) {					
	$finAPI	           = new FinancialAPI($db);
	$invoice_num  = $invoices[$i]['invoice_num'];
	$invoice          = $finAPI->get_invoice($invoice_num);

	include_once("../../common/printable_invoice.php"); 
	-->insert page break here;
}
type of thing. This worked fine when my layout used relative positioning.

However, since they made me change my layout to absolute positioning in order to fix the stupid lining up with envelope window problem, obviously this tactic does not work any more since the invoices all stack on top of each other if inserted into one big doc since they have the same absolute position.

What I want to know is, can anyone think of a good way (cross platfrom okay) that I can print many invoices in as few clicks as possible? Right now the woman has to click once on each invoice and print it which she is very annoyed about as then she has to do it about 80 times every time she wants to send out a fresh batch of invoices.

I dont' know if I can put each invoice inside a relatively positioned container div that starts at 0,0 relatively and then use absolute positioning within it... CSS is definitely not my strong point.


Here is my CSS:

Code: Select all

<style type="text/css">
#box1 {
	position:absolute;
	top:0mm;
	left:0mm;
	padding: 1mm;
	height: <? echo ($y_position - 2); ?>mm;
	width: <? echo (BOX_WIDTH + $x_position); ?>mm;
	background-color: transparent; 
	}

#box2 {
	position:absolute;
	top: <?=$y_position?>mm;
	left: <?=$x_position?>mm;
	padding: 3mm;
	height:<?=BOX_HEIGHT?>mm;
	width:<?=BOX_WIDTH?>mm;
	background-color: transparent; 
	font-weight: bold;
	}

#box3 {
	position:absolute; 
	top:0mm;
	left: <? echo (BOX_WIDTH + $x_position + 2); ?>mm;				 
	padding: 1mm;
	height: <? echo ($y_position + BOX_HEIGHT); ?>mm;
	width: <? echo ($usable_page_width - BOX_WIDTH - $x_position - 2); ?>mm;
	background-color: transparent; 
	}

#box4 {
	position:relative; 
	top:0mm;	
	left:0mm;
	padding: 1mm;
	width: <?=$usable_page_width?>mm;			 		 
	background-color: transparent; 
	}

#box5 {
	position:relative; 
	top:0mm;
	left: 0mm;		
	height: <? echo ($y_position + BOX_HEIGHT); ?>mm;
	width: <?=$usable_page_width?>mm;			 
	background-color: transparent; 
}
</style>
.
.
.
.
<div id="box5"> &nbsp; </div>
<div id="box1"> ...stuff... </div>
<div id="box2"> ...stuff...</div>
<div id="box3"> ...stuff... </div>
<div id="box4"> ...stuff...</div>
.
.
.
Post Reply