in reply to Re: Print a text file to a Windows network printer in a landscape orientation.
in thread Print a text file to a Windows network printer in a landscape orientation.

Quote: There are other ways to handle printing that might be a little more general.

I am most open to any other options to meet this requirement of printing a page to a Windows network printer in landscape orientation. I have tried to explore several options today such is working from the DOS command line. But I have not found anything that quite gets me to the finish line.

I am not sure your PDF or related suggestions would work, but if I am mistaken please enlighten me. There is no human interaction with the process once it is up and running. The application watches a directory during the quite night time hours. When if finds files are loaded there, it starts extensive processing of them resulting in many many database transactions and several text files.

One of these text files is sent to a printer where, the following morning, somebody grabs the resulting pages from the output tray, stuffs them into envelopes and mails them all over the State of California.

If anybody can suggest alternatives to the Win32::Printer{::Direct} option, I am all eyes.

Thank You
Ian

  • Comment on Re^2: Print a text file to a Windows network printer in a landscape orientation.

Replies are listed 'Best First'.
Re^3: Print a text file to a Windows network printer in a landscape orientation.
by TGI (Parson) on Apr 04, 2008 at 22:58 UTC

    The only other library I know of that lets you print from windows is Wx. There's a nice example in the wdperl_demo.

    You might be able to do something with Word (or perhaps another app) through OLE using Win32::OLE if you know OLE. I don't.


    TGI says moo

Re^3: Print a text file to a Windows network printer in a landscape orientation.
by mr_mischief (Monsignor) on Apr 04, 2008 at 22:33 UTC
    An easy workaround (although not very general) might leverage what type of networked printer you have. A JetDirect print server generally has FTP through which you can transfer any type of file (plain text, PCL, PostScript, raw) the printer attached to it can print. I'm not sure how to specify landscape printing other than at the printer then, though. A PostScript file can specify the orientation of its contents.

    If you're using a networked printer through the UNC path from Windows, you can probably control a PDF or ODF-compatible application on the server via OLE to do the printing. Whether that'd be easier than figuring out the detailed layout methods of Win32::Printer or getting Win32::Printer::Direct to use Win32::Printer's landscape mode I couldn't say.

    In the vein of using the DOS "print" command, that works with your server's print driver IIRC, so you should be able to set all of your printers (if you have more than one) to landscape on the server. Unfortunately, portrait v. landscape settings in the driver never seem to have worked with that command. It lets you specify which printer device to print to, including UNC paths. print /d:\\unc\path filename should work. It's easy enough to share a printer with a name "foo" on the server with a name of "bar", then shell out to print /d:\\bar\foo datafile. If it did landscape, you'd really be in luck.

    If you can get the file to an lpd somewhere from the Windows box, that might be worth investigating as there's an lpr for Windows (probably several). There are also lpd servers that run on Windows, for that matter.

    By using a PostScript-compatible printer, a PostScript document that sets its own orientation, and either the CLI-based print command or an lpr/lpd combo, you might have a solution that way.