PxPlus User Forum

Twitter Twitter Twitter

Author Topic: Duplicate Output Paper and PDF  (Read 1333 times)

Lawrence_Leavell

  • Silver Member
  • ***
  • Posts: 49
    • View Profile
Duplicate Output Paper and PDF
« 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.

Dave Fullerton

  • Silver Member
  • ***
  • Posts: 35
    • View Profile
Re: Duplicate Output Paper and PDF
« Reply #1 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


Mike King

  • Diamond Member
  • *****
  • Posts: 3817
  • Mike King
    • View Profile
    • BBSysco Consulting
Re: Duplicate Output Paper and PDF
« Reply #2 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.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com