Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

PDF::API2 page setup

by ksublondie (Pilgrim)
on Aug 17, 2011 at 23:00 UTC ( #920813=perlquestion: print w/ replies, xml ) Need Help??
ksublondie has asked for the wisdom of the Perl Monks concerning the following question:

I'm using PDF::API2 to create documents that are non-letter sized. Even though the pages are the correct size, when I go into the print dialog box of the open document, the paper size/type/etc is still set to letter and the printer can't automatically pick the correct printer tray.

Is there a way to programatically set these fields?

update

Here's my current code:

foreach (@data){ $line=144; $page= $pdf->page(); $page->mediabox('Legal'); $page->trimbox('Legal'); ... }

Comment on PDF::API2 page setup
Download Code
Re: PDF::API2 page setup
by Perlbotics (Abbot) on Aug 17, 2011 at 23:12 UTC

    The PDF::API2 doc has something to say about setting the mediabox. Does invoking this method improve the situation?

    $pdf->mediabox($name) $pdf->mediabox($w, $h) $pdf->mediabox($llx, $lly, $urx, $ury)

    Sets the global mediabox.

    Example:

    $pdf = PDF::API2->new(); $pdf->mediabox('A4'); ... $pdf->saveas('our/new.pdf'); $pdf = PDF::API2->new(); $pdf->mediabox(595, 842); ... $pdf->saveas('our/new.pdf'); $pdf = PDF::API2->new; $pdf->mediabox(0, 0, 595, 842); ... $pdf->saveas('our/new.pdf');

      That's exactly how I'm already setting the page size (I'm not aware of any other way to do it), but the print dialog box isn't recognizing the settings. Like I said, the pages are setup with the right size, the problem is in the print dialog box. It keeps trying to print to "Letter" for everything, no matter the size.
        It might also help to set the trimbox as well.

        To quote PDF page boxes:

        "The TrimBox defines the intended dimensions of the finished page. Contrary to the CropBox, the TrimBox is very important because it defines the actual page size."
Re: PDF::API2 page setup
by Neighbour (Friar) on Aug 18, 2011 at 10:24 UTC
    If you're printing from adobe's acrobat reader, try unchecking the option 'Choose paper source by PDF page size'. (Or adjust the page size to match :))
      That worked! However, it would be nice if Adobe would allow that to be a document setting like Word & WordPerfect do and not a workstation setting.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://920813]
Approved by toolic
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (7)
As of 2014-09-19 02:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls