Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: PDF::API2 page setup

by Perlbotics (Chancellor)
on Aug 17, 2011 at 23:12 UTC ( #920815=note: print w/replies, xml ) Need Help??


in reply to PDF::API2 page setup

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');

Replies are listed 'Best First'.
Re^2: PDF::API2 page setup
by ksublondie (Friar) on Aug 18, 2011 at 04:12 UTC
    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."
        I've tried the trimbox, but it is still wanting to print to Letter. When looking at the pdf file in notepad, I'm not seeing any reference to the word "Legal", or "Letter" either for that matter. Here's the header in the file:
        %PDF-1.4 % 1 0 obj << /Type /Catalog /ViewerPreferences << /NonFullScreenPageMode + /UseNone >> /PageLayout /SinglePage /Pages 2 0 R /PageMode /UseNone +>> endobj 2 0 obj << /Type /Pages /Kids [ 5 0 R ] /Resources 3 0 R /Count 1 >> e +ndobj 3 0 obj << /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> endobj 4 0 obj << /Producer (PDF::API2 2.019 [linux]) >> endobj 5 0 obj << /Type /Page /Contents [ 10 0 R ] /MediaBox [ 0 0 612 1008 ] + /Parent 2 0 R /Resources << /Font << /PaLiCBB~1313689461 6 0 R >> /P +rocSet [ /PDF /Text /ImageB /ImageC /ImageI ] >> /TrimBox [ 0 0 612 1 +008 ] >> endobj 6 0 obj << /Type /Font /Subtype /Type0 /DescendantFonts [ 7 0 R ] /Enc +oding /Identity-H /BaseFont /PalatinoLinotype /Name /PaLiCBB~13136894 +61 >> endobj 7 0 obj << /Type /Font /Subtype /CIDFontType2 /W [ 0 [ 535 ] 4 [ 610 ] + 11 [ 336 333 726 ] 15 [ 945 ] 18 [ 604 ] 20 [ 667 524 ] 138 [ 500 ] +140 [ 443 610 479 333 ] 145 [ 582 291 ] 148 [ 556 ] 151 [ 582 545 ] 1 +55 [ 395 423 326 ] 160 [ 833 ] 342 [ 500 500 ] 346 [ 500 ] 348 [ 500 +500 500 ] 496 [ 250 ] 550 [ 320 ] 556 [ 333 ] 561 [ 250 ] ] /BaseFont + /PalatinoLinotype /CIDSystemInfo << /Supplement 0 /Ordering (Identit +y) /Registry (Adobe) >> /CIDToGIDMap /Identity /DW 1396 /FontDescript +or 8 0 R >> endobj 8 0 obj << /Type /FontDescriptor /Ascent 731 /Flags 42 /AvgWidth 524 / +Descent -284 /FontWeight 400 /StemV 0 /CapHeight 839 /FontFamily (Pal +atinoLinotype) /FontName /PalatinoLinotype /MaxWidth 1396 /FontStretc +h /Normal /Style << /Panose <010402040502050505030304> >> /ItalicAngl +e 0 /StemH 0 /XHeight 419 /FontBBox [ -169 -291 1419 1049 ] /FontFile +2 9 0 R /MissingWidth 1396 >> endobj 9 0 obj << /Length1 48568 /Filter [ /FlateDecode ] /Length 11 0 R >> s +tream

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://920815]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2018-07-20 18:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?















    Results (439 votes). Check out past polls.

    Notices?