Duplex printing - start content on odd page

150 views
Skip to first unread message

Bjorn

unread,
Jul 13, 2010, 3:09:49 AM7/13/10
to dompdf
I want to convert several documents to a single pdf-file. To attach
the documents to each other I can use the page-break-before property.
This works fine when one prints the combined document single sided.
Only when one prints it double sided it can be that a intended new
document starts at a even page (counts starts at 1), so at the back of
a page.

It looks like DOMPDF does nothing depending on the value {always,
left, right}.

Does someone know a possibility to start a new block-element on a odd
page?

BrianS

unread,
Jul 14, 2010, 9:40:53 PM7/14/10
to dompdf
I haven't tried anything like this myself, but there are a few methods
available with inline scripting that might help, specifically $pdf-
>new_page() and $pdf->get_page_number(). Between your documents you
could include something like the following:

<script type="text/php>
if ($pdf) {
$pagenum = $pdf->get_page_number();
if ($pagenum % 2 == 1) {
$pdf->new_page();
}
}
</script>

Give it a shot and let me know what happens. If that doesn't work I'll
look into it some more.

Bjorn Lamers

unread,
Jul 21, 2010, 7:52:19 AM7/21/10
to dom...@googlegroups.com
I tried to modify some code in Page_Frame_Decorator::check_forced_page_break, and some other files to get access to the canvas etc, to handle page-break-before-values left and right properly. The parses translates left and right to always.
But i couldn't get it to work properly, sometimes it missed a page.

I fixed my problemen by using PDFTK and merge several document together. That worked for me because it were separate documents each containing their own page numbering. So I didn't had to find out how to reset DOMPDF's page numbering.

--
You received this message because you are subscribed to the Google Groups "dompdf" group.
To post to this group, send email to dom...@googlegroups.com.
To unsubscribe from this group, send email to dompdf+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/dompdf?hl=en.


BrianS

unread,
Jul 21, 2010, 2:23:36 PM7/21/10
to dompdf
That would have been my solution as well. Not everyone has access to
execute programs on their server, so I try to find other alternatives
when I can. We'll look into the problem for a future release.

On Jul 21, 7:52 am, Bjorn Lamers <bjorn.lam...@gmail.com> wrote:
> I tried to modify some code in
> Page_Frame_Decorator::check_forced_page_break, and some other files to get
> access to the canvas etc, to handle page-break-before-values left and right
> properly. The parses translates left and right to always.
> But i couldn't get it to work properly, sometimes it missed a page.
>
> I fixed my problemen by using PDFTK and merge several document together.
> That worked for me because it were separate documents each containing their
> own page numbering. So I didn't had to find out how to reset DOMPDF's page
> numbering.
>
> > dompdf+un...@googlegroups.com<dompdf%2Bunsu...@googlegroups.com>
> > .
Reply all
Reply to author
Forward
0 new messages