is there any way to perform exact layout to paper in html and CSS?

39 views Asked by At

I am interested in generating a web page that generates an exact, deterministic format on paper.

It doesn't have to be portable between browsers, it doesn't have to be any particular layout, but I need to know the exact location of the resulting components so I can write code to scan in certain fields when they are filled in.

Of course, I could use a different formatting language. Postscript for example, would provide exact formatting. But I want to use html/css for other applications, so it would be convenient if the same format would work.

Suppose I created a web page some text and an input. For example:

<!DOCTYPE html>
<body>
  1. What is 2+2? <input size="3" class="q"/>
</body>
</html>

the web page is not guaranteed a size, that depends on the window, but printing it out is a standard size. Let's say my default is US letter. The page does seem to print deterministically. I would prefer to be able to control the layout exactly so it's portable, but I can live without and just use one browser. The real question is, can I determine the exact location of each field so I can come up with code to scan the rectangles.

0

There are 0 answers