Link File for PDF

Started by GlenWill, April 19, 2022, 02:33:55 PM

Previous topic - Next topic

GlenWill

I inherited support of an application written in PxPlus.  It has a lot of reports built in, and they all use a common program to prompt for a printer to print to.  The printer selection in turn is using Link Files to control which printer to send to. 

For Example, if I run a report and select printer P3, there is a link file called P3 with this line in it:
[Pvxdev]| lpr -P Aficio-MP-301-2     

This works great, and I've been able to replace physical printers with updated models, and update the link file to the new Unix printer name, and printing works fine.

I'd now like to designate one of the printers to send to a PDF file.  I've been successful printing to a CUPS PDF printer I setup, using this line:
[Pvxdev]| lpr -P Cups-PDF -C "PDF_Print"

However, I don't have a lot of control on the fonts and other attributes.  I have written some programs using *PDF*, so I thought I could create a link file that way, and print using *PDF*.  I updated my P1 link file to this:
[Pvxdev]*PDF*;FILE=/home/glen/pvxdata/TestPDF.pdf;

But instead of printing to a PDF, my print output actually ends up written onto the P1 link file, appended after the above line. Does anyone know what I might be doing wrong?  I've tried removing the "[Pvxdev]", but with the same result. 

My intention if I can get this to work is to create a driver file and specify it in the link file, and set fonts and page size with mnemonics.

Thanks for any help.

Glen

Mike King

Try using the "*upl" program to create the link file (or RUN "**" press "U", press "P", press "L").

A link file basically needs to be 256 bytes long with the first 8 bytes containing [Pvxdev] or [Pvxlnk] (use Pvxlnk for files).  Following that would be the actual pathname you want to use in the next 60 bytes.
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com

GlenWill

Thank you.  I was able to get it to print a PDF by removing all options after the filename:
[Pvxdev]*PDF*;FILE=/home/glen/pvxdata/TestPDF.pdf;

...and then padding out the file to 256 bytes.

Unfortunately, that means I can't specify options past position 69, since that's where the driver name is supposed to start.  That means I can't use most of the *PDF* options. I'm trying to see if I can set what I need using a driver file. I was able to get a driver file recognized. 

Any hints on this?  Is there a way to override the position 69 restriction so I can specify more *PDF* options?

Thanks,
Glen

Mike King

Actually there are a couple of options, but the easiest is instead of using a Pvxdev/Pvxlnk file use a PREFIX file.

Basically a PREFIX file consists of a file whose record define the real pathnames and options for files used by the application.  If a PREFIX file is defined (using the PREFIX FILE directive), whenever a file is opened the system will access the PREFIX FILE by its primary key using the pathname provided in the program.

So in your case you could create a PREFIX FILE with a record whose key is "P3" and a record which contains what you really to open.

For example:

DIRECT "pfxfile", 20

OPEN (1) "pfxfile"
WRITE (1,key="P3") "*PDF*;FILE=/home/glen/pvxdata/TestPDF.pdf"
CLOSE (1)

Then in your application somewhere in its start up / initialization:

PREFIX FILE "pfxfile"

Now whenever a program issues OPEN (1) "P3" the system will convert the pathname to open the PDF file instead.

For more information see: https://manual.pvxplus.com/?directives/prefix.htm
Mike King
President - BBSysco Consulting
eMail: mike.king@bbsysco.com