Menu

problems with page breaks

2004-08-02
2013-04-10
  • James Grill

    James Grill - 2004-08-02

    Hi,

    I'm working on an app. that prints many lines inside a loop - potentially several pages at a time. I am currently using a templating system to repeat the following line in my pdml file:

    <multicell left=10% border=1 width=80% next=break>{DATA.ip} {REPORT.severity} {REPORT.portname} ({REPORT.portnum}/{REPORT.portproto}) {REPORT.report}</multicell>

    The problem is that the first page does not break - it starts over at the top and writes on top of the same page. Other pages after that seem ok. It's always the first page that gets garbled.

    Any ideas?

     
    • Henri T.

      Henri T. - 2004-08-03

      Hi,

      PHP is already a templating system, and PDML is designed to let users take advantage of it, so you could do:

      <?php foreach ($list as $line) { ?>
      <multicell left=10% border=1 width=80% next=break>
      <?php echo $line["ip"].' '.$line["severity"]; //... ?>
      </multicell>
      <? } ?>

      That doesn't really answer your question though.
      I tried, but can't reproduce what you describe. Can you send me the smallest test-case you can put together that exhibits the bug?

      Thanks,
      Henri

       
      • smike

        smike - 2007-07-04

        i've got a database that tracks work orders for a consulting company. each work order has a 'tasks' field that contains multiple paragraphs of content. they wanted to be able to number related groups of paragraphs, so any paragraph that starts with '-- ' (hyphen hyphen space) gets a new item number.

        the problem i was having was that the multicell would span multiple pages automatically, but NOT honor the left margin when there was a large block of text.

        here is the php code i finally got to work... you can see an example at http://www.5happy.com/lindegroup/Linde-WO-40115.pdf

                foreach($the_open_items as $this_key=>$this_val) {
                    $this_val = preg_replace('/\n*/','',$this_val);
                    $this_val = preg_replace('/^ +/','',$this_val);
                    $this_val = preg_replace('/  +/',' ',$this_val);
                    $this_val = rtrim(ltrim($this_val));
                    if ( strlen($this_val) < 2 ) { continue; }
                    $counter++;
                    $this_val = wordwrap($this_val, 95, "</multicell><B><cell width=15% height=100% align=right valign=top>&nbsp;</cell></B><multicell width=65% align=left height=100% valign=top next=down>");
                    $the_pdml .=<<<EOF
        <font size=10pt>
        <B><cell width=15% height=100% align=right valign=top>$counter.</cell></B>
        <multicell width=65% align=left height=100% valign=top next=down>$this_val</multicell>
        <cell width=15% height=100% align=right valign=top>&nbsp;</cell>
        </font>
        <BR>

        EOF;
                }

         
    • James Grill

      James Grill - 2004-08-03

      What I meant by templating system is that I'm using a php templating system similar to smarty to parse my pdml file. I prefer to keep html/pdml out of my logic. ;) So, in effect, what I'm doing is the same as what you posted inside a the loop above.

      Here is more of an example of my pdml:

      -- snip --
      <page>
      <!-- BEGIN: reportList -->
      <multicell left=10% border=1 width=80% next=break>{DATA.ip} {REPORT.severity} {REPORT.portname} ({REPORT.portnum}/{REPORT.portproto}) {REPORT.report}</multicell>
      <!-- END: reportList -->
      --/snip--

      Basically, I parse `reportList` above as many times as a I need to with my php template engine. I have a few pages before this bit here that I made by specifically calling <page>. In the case of the block above, I call <page> once and then it runs on for possibly 50 to 100 times in a loop. I've tried it as plain text without the multicell and I get the same thing: The first page gets garbled by being written over top of and all the others seem fine with the exception of the cells getting split up. I would have thought that they would break before or after a cell and not right in the middle, which seems to trash the alignment for the remainder of the cell on the next page. :-(

      Thanks for the help. I could maybe post my pdf file somewhere for you to see, or email it to you if that would help.

       
      • Henri T.

        Henri T. - 2004-08-03

        When trying to reproduce with the public version, all I can get is the "1st line of 2d page weird left-alignment" bug reported in the bug tracker, but not the overlaying behavior you describe.
        Could you email me the PDML document that makes this happen, rather than the PDF? That would help me understand what's going on.

        Thanks,
        Henri

        My attempt to reproduce used:
        <pdml>
        <head>
        <title>Sample PDML document</title>
        </head>
        <body>
        <page/>
        <multicell left=10% border=1 width=80% next=break>{DATA.ip}
        {REPORT.severity}
        {REPORT.portname} ({REPORT.portnum}/{REPORT.portproto})
        {REPORT.report}</multicell>
        <multicell left=10% border=1 width=80% next=break>{DATA.ip}
        {REPORT.severity}
        {REPORT.portname} ({REPORT.portnum}/{REPORT.portproto})
        {REPORT.report}</multicell>
        ...
        ( repeated as many time as necessary to go over the first page and some )
        ...
        </body>
        </pdml>

         

Log in to post a comment.