PxPlus User Forum

Main Board => Discussions => Programming => Topic started by: Lawrence_Leavell on August 06, 2019, 03:13:47 PM

Title: Duplicate Output Paper and PDF
Post by: Lawrence_Leavell on August 06, 2019, 03:13:47 PM
Is there a way to modify a printer such that it prints to PDF and to a hardcopy at the same time?
This is a *nix CUPS system with cups-pdf installed.
Title: Re: Duplicate Output Paper and PDF
Post by: Dave Fullerton on August 06, 2019, 04:02:56 PM
Hi Lawrence:

We use repeat_data to do just what you're asking.  We will open a PDF file as follows:

02305 if dup_out then close (dup_out)
02310 dup_out=unt; open (dup_out,opt="MARGINS=250:500:500:500;OVERWRITE;FILE="+px_pdf$+file_name$)%wdx$+"*pdf*"
02315 print (dup_out)'font'(%bill_font$,%font_size,""),'DF',
02320 print (dup_out)'lpi'(6),'cpi'(10),


Once the file is opened, we then do this:

repeat data to out on dup_out

where 'out' is our output channel (*winprt*).

I hope this helps.

Regards

Dave Fullerton

Title: Re: Duplicate Output Paper and PDF
Post by: Mike King on August 06, 2019, 04:12:58 PM
Lawrence,

Generally the Linux print driver can accept a PDF file directly using the 'lp' command.

Given this why not just create the PDF file and pass it to the 'lp' command when closed?

Something like:

  OPEN (hfn) "*pdf*;file=pdffile_path.pdf"
  MNEMONIC (LFO) '*R' = "lp pdffile_path.pdf"

The '*R' mnemonic defines the OS command to execute once the file is closed.