I've got a script that creates a PDF and sends it to remote print server running CUPS.

Using Net::Printer, I set up the printer:

my $print_server        = "remote_print.server";
my $printer             = "lp1234";

my $lineprinter = new Net::Printer( 
                          filename    => $pdf,
                          printer     => $printer,
                          server      => $print_server,   
                          port        => 515


# Print and get printer stauts.
$result = $lineprinter->printfile();

The remote printer is a label printer, Zebra ZT420, configured with Zebra PPD.

Now, the problem is that the printed label is forced somehow, somewhere on the way, to vertical orientation, instead of horizontal one, no matter how I set up the PDF file (be it force it to be vertical or horizontal).

When printing manually, e.g. using Document Viewer on GNOME, or system Print Dialog, the output is printed correctly.

Why does it happen with my code?

What did I miss or misconfigure?

Is there a way to force orientation when sending it to a printer?

  • Instead could you ask cups to send the job for you? eg perl net-cups.
    – meuh
    Aug 27, 2019 at 9:37
  • It seems that the question is misleading - Net::Printer sends to an lpd server and port 515 is a port for that, if it were sending to cups, it should have been port 631 . (See metacpan.org/pod/Net::Printer )
    – le_top
    Mar 28, 2021 at 22:07

1 Answer 1


Unless the setting could be changed elsewhere, I might try changing line 28 of the Zebra PPD file from *LandscapeOrientation: Plus90 to *LandscapeOrientation: Plus0.

  • That might make sense, but would require tinkering with print server configuration, which cannot be done easily (ancient way of configuring printers). I may try forcing it on this one printer and see how it would react. Thanks!
    – Bart
    Aug 30, 2019 at 7:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .