0

Is it possible to create a hard page return in your PHP code so that wehn the user prints the output, the page break will occur where it is defined?

If this is possible, how is it done. I have not found anything in my Google searches.

Any help is appreciated!
Cheers,
Chris

3
Contributors
6
Replies
7
Views
6 Years
Discussion Span
Last Post by chrishea
0

If you create the output as a Word file, you can tell it where you want the page breaks. I don't have the details handy but if you want to go that way I can dig up some details (I have done it but I would need to dig through a program to remember how).

0

If you create the output as a Word file, you can tell it where you want the page breaks. I don't have the details handy but if you want to go that way I can dig up some details (I have done it but I would need to dig through a program to remember how).

If your users don't mind the hassle of opening a word document, you might consider a PDF for compatibility. I know a lot of people, myself included, hate them, but there are a bunch of PDF libraries for PHP, probably a lot more than there are word document libraries for PHP.

0

How do you take a php file and make it a pdf? I will try to work with the link you sent about FC.

0

Well first, there's PDFLib. It's the popular choice (it's the library listed on PHP.NET), but depending on usage, you might have to pay for it.
Some other notable choices a FPDF and TCPDF.
There are also a few HTML2PDF converters such as dompdf, but if you aren't going to use the CSS property described in my link, they kind of defeat the purpose.
If you want help with the information provided in my original link, write back and I'll explain.

0

If you want to use PDF then HTML2PDf is a good option. In fact any time that you want formatted paginated output, it is worth considering. Here is small example of defining pages (with the optional headers and footers) as input to HTML2PDF:

<page style="font-size: 14px">
     test0
     <br>
     Here is some test text
     <br>
    <!-- This kind of page break doesn't work
     <p style="page-break-before: always">
     Here is page 2 maybe
     </p>
     -->

     The end of page 1
</page>

<page backtop="7mm" backbottom="7mm" backleft="10mm" backright="10mm" style="font-size:12px">
    <page_header>
          <b><div style="font-size:10px; color:silver;">Here is the page header</div></b>
    </page_header>

     Here is page 2
     can I do another page this way?
     <br>Yes I can
    <page_footer>
          <b><i><div style="font-size:10px; color:silver;">This is the page footer</div></i></b>
    </page_footer>
</page>

<page pageset="old">
     Now here is page 3
</page>

Each <page> command initiates a new page. There are a number of optional parameters that you can use. The pageset="old" picks up the parms from the previous page. One thing to note is that it is very particular about getting correct html. If you miss closing tags and that sort of thing it won't work. Thus, you can't just throw any html at it and expect it to work. You may need to do a little tweaking. I have been using the older version quite successfully for some time now and this one is even better.

I have some stuff on my website for the older version. I have to do an update for this newer version because it is a significant improvement. I built a driver for testing and I will post that on my site when I get a chance.

Edited by chrishea: n/a

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.