Buidling a Printable Webpage

Hello everyone and thanks for your help in advance. I need to develop a printable billing statement. In the past, my go-to solution would have been to dynamically generate some type of PDF document. However, I am reading more and more about printable web pages being used rather than involving a separate programming paradigm. Is it possible or desirable to create a billing statement using a web page and what are the drawbacks and advantages of doing so? How do I get started?

Thanks again.

Hi there @kmcnet Have you seen this thread?

I did see the thread, but unfortunately missed the session. I don’t see a transcript anywhere.

The thread is the transcript. The discussion took place here on the forums.

1 Like

The thread IS the transcript.

Edit: Drat. Ninja’d by the bear :slight_smile:

1 Like

OK. I’m really not the sharpest tool in the shed (just ask my wife) but it really looks all over the board including some very expensive plug-ins. Is it just a bad idea to try to create printable HTML?

If it’s just a normal web page, and you want it to look better when printed, it’s not that difficult. You can create a print specific css.

<link rel="stylesheet" type="text/css" href="css/style.css">
<link rel="stylesheet" type="text/css" media="print" href="css/print.css">

Or use a media query in the main css if you prefer.

@media print {...}

Most styling will already be done in the main css, but you can override certain things specifically for printing.

Thanks for the response. I need to develop a billing statement that will be, at the most two printed pages. The statement will need to be displayed on the website as well as be printable, so my thinking was to simply reuse the page and reformat with css. So at most, I need to handle one page break (which I have no idea how to handle) and then try to get the formatting to where it looks good in print (have never done this before).

The answer to that would seem to be simply page-break-after or page-break-before.

The trouble is there is only partial support for these

page-break-before looks good as long as it’s auto or always.
But avoid, left, right look to be a Firefox FAIL

1 Like

Great response and lots of help. I appreciate it. One last noob question is the implementation. The examples show a statically assigned breakpoint after a table of contents section. What happens if a table of contents is long enough to span two pages. Or if the table of contents is dynamically edited and lengthened by some type of user input. Is there a way to programmatically insert a page break? For example, in a very crude print document, you might implement a line-counter and break after line 25 has been reached. Obiously HTML requires something more sophisticated, but I think you get the idea.

The breaks have to be hard coded in the HTML - some browsers will even ignore them when applied via an external CSS.If you want more flexibility then the alternative has always been to convert to PDF.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.