473,473 Members | 1,831 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Pixel positioning across multiple printed pages

Hello,

I'm having a hard time trying to configure printed output that consists
of multiple pages. The idea is the following:

<div style="
border: 1px solid blue;
position: absolute;
top: 20px;
left: 20px;
width: 100px;
height: 100px;
page-break-after: always;
">AA</div>

<div style="
border: 1px solid green;
position: absolute;
top: 30px;
left: 30px;
width: 80px;
height: 80px;
">BB</div>

<div style="
border: 1px solid orange;
position: absolute;
top: 30px;
left: 250px;
width: 80px;
height: 80px;
">CC</div>

The page-break-after does not work here because of the absolute
positioning. When I change 'absolute' to 'relative' in the code, then
the printed page breaks correctly between the <div>'s:

<div style="
border: 1px solid blue;
position: relative;
top: 20px;
left: 20px;
width: 100px;
height: 100px;
page-break-after: always;
">AA</div>

<div style="
border: 1px solid green;
position: relative;
top: 30px;
left: 30px;
width: 80px;
height: 80px;
">BB</div>

<div style="
border: 1px solid orange;
position: relative;
top: 30px;
left: 250px;
width: 80px;
height: 80px;
">CC</div>

The enclosing tags for the code are <body>...</body>. But this
construction is not clean and error-sensitive. Plus, the last <divis
displayed lower than the middle <div>, though they have identical
top-instructions (30px) (at least in MSIE).

As a last resort, I tried to format my print layout with a huge pixel
height across multiple pages; something like this:

<div style="
border: 1px solid blue;
position: absolute;
top: 20px;
left: 20px;
width: 100px;
height: 100px;
">XX</div>

<div style="
border: 1px solid green;
position: absolute;
top: 1200px;
left: 30px;
width: 80px;
height: 80px;
">YY</div>

But I'm going over 50,000 pixels here and the absolute position becomes
unreliable/ugly across multiple printed pages. Especially because I'm
doing it on an old matrix pin printer with form feed.

Ideally I'm looking for a way to use absolute pixel positioning across
multiple printed pages, something like this:

<div "position:absolute;top:10px;left:10px;">AA</div>
[start new printer page + reset top&left settings to new page]
<div "position:absolute;top:20px;left:20px;">BB</div>

Any suggestions/workarounds ?

Thanks,

--
Bart

Jul 13 '06 #1
3 2773
Bart Van der Donck wrote:
[...]
Ideally I'm looking for a way to use absolute pixel positioning across
multiple printed pages, something like this:

<div "position:absolute;top:10px;left:10px;">AA</div>
[start new printer page + reset top&left settings to new page]
<div "position:absolute;top:20px;left:20px;">BB</div>
For future reference: there is a solution. Split up the page in as much
iframes as needed and then use an absolute position inside each iframe.

--
Bart

Jul 13 '06 #2
Bart Van der Donck wrote:
Bart Van der Donck wrote:
>[...]
Ideally I'm looking for a way to use absolute pixel positioning across
multiple printed pages, something like this:

<div "position:absolute;top:10px;left:10px;">AA</div>
[start new printer page + reset top&left settings to new page]
<div "position:absolute;top:20px;left:20px;">BB</div>

For future reference: there is a solution. Split up the page in as much
iframes as needed and then use an absolute position inside each iframe.
If this is really a web page, primarily meant to be read in web clients,
this is awful and I suspect you'll find the splitting up and later
maintenance as changes are made to be murder.

If this is meant primarily for highly formatted printing, HTML is not
designed for that. Create a PDF.
Jul 13 '06 #3
Harlan Messinger wrote:
[...]
For future reference: there is a solution. Split up the page in as much
iframes as needed and then use an absolute position inside each iframe.

If this is really a web page, primarily meant to be read in web clients,
this is awful and I suspect you'll find the splitting up and later
maintenance as changes are made to be murder.

If this is meant primarily for highly formatted printing, HTML is not
designed for that. Create a PDF.
Thanks for your comment - yes I'm aware of that but it's only for
intranet use and I can control all browser print settings (top/left
marges, header/footer, etc.) and it is the same printer.

It is not that much data that I need to print per page (ca 5-10
positioned divs with very small content), but it may be many pages and
the positioning needs to be exact. The code is quite short and not that
complicated; I've 1 master file with 20-50 iframes each having a style
like

border: 0px; position: absolute; top: 0px; left: 0px;
width: 99%; height: 900px; margin: 0px; padding: 0px;
page-break-after: always;

Then I have one CGI file for the iframe contents
(iframecontents.cgi?ID=123, iframecontents.cgi?ID=124, etc.), with each
5-10 divs like:

<div style="
position: absolute;
top: 20px;
left: 20px;
">first data</div>
<div style="
position: absolute;
top: 40px;
left: 40px;
">second data</div>

--
Bart

Jul 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: Tom Szabo | last post by:
Hi, Just wondering if there are any disadvantage in absolute positioning controls on a page? In example instead of putting the text fields into a table to align properly, one would absolute...
7
by: glutinous | last post by:
I've looked at manuals and experimented until my brain's oozing out of my ears, and I still can't figure out what I anticipate will prove to be fairly basic css layout knowledge. I'd be amazed if...
0
by: John A Grandy | last post by:
for asp.net web-forms meant to be printed : apparently, a style="POSITION: ABSOLUTE" panel (asp.net renders this as an html div element) *following* a page-break does not absolutely position the...
4
by: Jay | last post by:
Still can't seem to find a solution to printing a lengthy datagrid on multiple pages including datagrid headeron each page. I am not using Crystal Reports or Reporting Services or VStudio. Any...
9
by: McGeeky | last post by:
Is there a way to get a user control to remember its state across pages? I have a standard page layout I use with a header and footer as user controls. Each page uses the same layout by means of...
2
by: Raul Medina | last post by:
I am trying to print the same visual basic report multiple times in my VB 6.0 application using the command <reportObject>.printReport False, rptRangeAllPages. The only thing that differs between...
6
by: Bill | last post by:
Hi I am trying to get my listbox items to print if they stream past the one page mark. my code is working for one page of information (if the e.hasmorepages) is not there. But I am having...
2
by: =?Utf-8?B?R2lyaXNo?= | last post by:
Hello All, I am displaying a report in a gridview and also in a separte html table. When the user clicks a print button, I print the report (from gridview or from html table). But I want to repeat...
14
by: Fistro | last post by:
I'm trying to find a design that would allow me to build web pages without having to worry about compatibility issues (not too much, in any case,,,) I've came across this CSS layout technique:...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.