0

Hiyas,

I'm trying to print to an older duplex printer, and paper size is about letter-size wide, but only a half letter-size tall, so I'm trying to define a custom page output like so. I've tried many things, but this is where I'm at right now, probably not all necessary, but nothing seems to be working.

    $width = '300';
    $height = '150';
    $pageLayout = array($width, $height); // or array($height, $width) 
    $pdf = new TCPDF('P', 'mm', $pageLayout, true, 'UTF-8', false);

    // set array for viewer preferences
    $preferences = array(
        'FitWindow' => false,
        'NonFullScreenPageMode' => 'UseNone', // UseNone, UseOutlines, UseThumbs, UseOC
        'ViewArea' => 'MediaBox', // CropBox, BleedBox, TrimBox, ArtBox
        'ViewClip' => 'MediaBox', // CropBox, BleedBox, TrimBox, ArtBox
        'PrintArea' => 'MediaBox', // CropBox, BleedBox, TrimBox, ArtBox
        'PrintClip' => 'MediaBox', // CropBox, BleedBox, TrimBox, ArtBox
        'PrintScaling' => 'AppDefault', // None, AppDefault
        'Duplex' => 'DuplexFlipLongEdge', // Simplex, DuplexFlipShortEdge, DuplexFlipLongEdge
        'PickTrayByPDFSize' => false
    );
    $pdf->setViewerPreferences($preferences);

    $pdf->AddPage('P', $pageLayout, false, false);

But the output of this is: tcpdf output

Anytime I try to change the height, it seems to affect the width. If I change the width, it still affects the width, and other sizes just don't come out as you would expect. Anyone have a suggestion, or know if I'm doing something wrong?

Ryan Weiss
  • 1,308
  • 1
  • 14
  • 36
  • take a look here [http://stackoverflow.com/questions/3948818/tcpdf-custom-page-size](http://stackoverflow.com/questions/3948818/tcpdf-custom-page-size) – Hilarius L. Doren Jun 24 '16 at 06:09
  • Tried all that mate, thanks. I just decided to change the entire operation to use wkhtmltopdf, spit out a webpage, and call a background service to render it... much easier to style as a webpage, and the printing and sizing is all working properly! – Ryan Weiss Jun 25 '16 at 07:14

0 Answers0