PDF printing with background image

Discussion about printing issues and techniques.

Moderators: Susan Smith, admin, Gabriel

Post Reply
DBlankenship
Posts: 3
Joined: Mon Jun 08, 2009 7:10 pm

PDF printing with background image

Post by DBlankenship »

I have read the BR Wiki and the 4.2 notes from the 2012 Conference. At first I read the Wiki to mean that the background image was specified in the OPEN statement. I then realized that it referred to the command as "like NWP syntax". I have tried everything I can think of and have not been able to make this work. Could someone specifically say which versions of BR 4.2, which version of the PDF library, and provide a snipet of a program that will correctly insert a background image?

Steve responded by using a graphic file. I am specifically looking for the way to implement "\Epdf=" referred to in the documentation. To apply a background image using a PDF is a simple command using PDFTK.EXE. The plus here is that you do not have to repeat the image on each page. The resultant file size is the size of the image + the PDF. The image is NOT repeated for each page.

It is my hope that the \Epdf= utilizes the same technology.

David
Last edited by DBlankenship on Thu Mar 03, 2016 10:02 pm, edited 1 time in total.
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Re: PDF printing with background image

Post by bluesfannoz »

Dave
Here is the code we use to put a background image on a pdf document. This is with 4.20o

Code: Select all

16670     If WBPLATFORM$="WINDOWS" AND FILE(99)=-1 Then Open #99: "NAME=PDF:,PrintFile="&OFILE$&",REPLACE,RECL=5000",Display,Output 
16790     Print #99: "[PIC(8,10,ddback.png)]";
The setup files for ours are these:

pdflib4-win32.dll must be in the same folder as BR

I have attached a PDF.SYS
Attachments
pdf.sys
(8.3 KiB) Downloaded 675 times
Steve Koger
Computer Specialist
SEKESC-MACS Division
DBlankenship
Posts: 3
Joined: Mon Jun 08, 2009 7:10 pm

Re: PDF printing with background image

Post by DBlankenship »

Clarification on my original post...

Steve responded by using a graphic file. I am specifically looking for the way to implement "\Epdf=" referred to in the documentation. To apply a background image using a PDF is a simple command using PDFTK.EXE. The plus here is that you do not have to repeat the image for each page. The resultant file size is the size of the image + the PDF. The image is NOT repeated for each page.

It is my hope that the \Epdf= utilizes the same technology.
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Re: PDF printing with background image

Post by bluesfannoz »

Look in the PDF.sys I think there are some definitions for pdf=

I do not believe it uses the same technology as pdftk.
Steve Koger
Computer Specialist
SEKESC-MACS Division
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Re: PDF printing with background image

Post by John »

I am trying to do this now - I'd love to print a PDF and fill it out. I haven't used any native BR printing for years (only RTF and VB6). So I am trying to set up a very simple example... I thought it might be easier first to print an image, so here's the code I have

Code: Select all

00010 ! 
16670    Open #99: "NAME=PDF:,PrintFile=test.pdf,REPLACE,RECL=5000",Display,Output
16790     Print #99: "[PIC(8,10,ddback.png)]";
17000    close #99:
I included the PDF.sys mentioned above in my brconfig.sys.

Whenever I try to run this I get a couple errors stating that I do not have a file called pdflib4-x64.dll. I looked on the FTP site for it but am unable to find it. The BR-Wiki makes no mention of it... I did (on the FTP site) find a similar file but it appears to be for 32 bit BR... eventually I'll need both, but mostly the 64 bit one. Can anyone help me find pdflib4-x64.dll?

:shock:
John Bowman
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: PDF printing with background image

Post by Susan Smith »

Hi John,

I'm not sure where to download the pdflib, but it is required (to be in your BR folder) in order to print to PDF in BR. There was some mention of it in the BR 4.2 release notes, but that information is obviously out of date now.

Transparency Support In PDF Printing

Previous editions did not support see through print fiends in PDF printing. It is, however, supported in NWP and HP supports it as well. This has been added to BR PDF printing. It will require a new pdflib. So BR will now support either pdflib2 or pdflib3, whichever is present.

There will not be a 64 bit pdflib issued for the foreseeable future. If you need to do PDF printing, use the 32 bit client which works fine on 64 bit machines and with 64 bit BR servers.

-- Susan
bluesfannoz
Posts: 291
Joined: Fri Jun 19, 2009 9:01 am
Location: Lawrence, Kansas
Contact:

Re: PDF printing with background image

Post by bluesfannoz »

No 64 Bit version at this point. At the last conference we were told he was moving to a new PDF engine and should get it in a later 4.3 release. Yet to see said version.
Steve Koger
Computer Specialist
SEKESC-MACS Division
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Re: PDF printing with background image

Post by Susan Smith »

John,

Here is the 32 bit version:
ftp://ftp.brulescorp.com/Dan/420o/winutil/

-- Susan
Gabriel
Posts: 412
Joined: Sun Aug 10, 2008 7:37 am
Location: Arlington, TX
Contact:

Re: PDF printing with background image

Post by Gabriel »

You're not gonna like this. But your code is correct. The only problem you have is the library is missing. And the problem is, there is no 64 bit pdf library.

The 32 bit version of BR runs fine on 64 bit PCs. I had to switch all my users to 32 bit BR because you (a) don't really gain much with 64 bit BR, who needs more then 4GB of ram for their BR programs anyway??? And (b) pdf printing is better then the non-existent performance improvement they'd get with 64 bit BR and (c) 64 bit BR doesn't support other stuff too, like the BR Web Server, for example.

I wish I had better news for you. At least you know you're doing it right.

Is there an important reason you need your clients to be running 64 bit BR?

gabriel
John
Posts: 555
Joined: Sun Apr 26, 2009 8:27 am

Re: PDF printing with background image

Post by John »

for reference purposes I wanted to add this sample program to this thread. In case someone else wants to make a PDF on top of a PDF background
I attached the PDR files - of course their path would need to be modified, but otherwise this should function in any
32 bit BR with the pdflib4-Win32.dll (get from br ftp site) file in place

Code: Select all

20140   dim pdfOutFile$*1024
20180   pdfOutFile$='test.pdf'
20200   Open #hPdfOut:=1: 'Name=PDF:,PrintFile='&pdfOutFile$&',Replace,RecL=5000',Display,Output
25020     print #hPdfOut: newpage
25040     fn_w2('R:\Core\pdf\W-2 copy 1.pdf')
25060     print #hPdfOut: newpage
25080     fn_w2('R:\Core\pdf\W-2 copy 2.pdf')

38000   close #hPdfOut:
38020   exe 'sy -C "'&os_filename$(pdfOutFile$)&'"'
38040 fnxit
50000 def fn_w2(background_pdf$*256)
50020   if ~w2_setup then
50040     w2_setup=1
50050     dim xLine(12)
50060     yCol(1)=230
50080     yCol(2)=3200
50100     yCol(3)=4420
50120     xLine(1)=xLineTemp=225 : xLineHeight=240
50140     for xLineItem=2 to 10
50160       xLine(xLineItem)=xLineTemp+=xLineHeight
50180     nex xLineItem
50200     y2Col(1)=230
50220     y2Col(2)=500
50240     y2Col(3)=1800
50260     y2Col(4)=2650
50280     y2Col(5)=3450
50300     y2Col(6)=4300
50320     y2Col(7)=5100
50340     xLine(11)=xLineTemp+=(xLineHeight+100)
50360     xLine(12)=xLineTemp+=xLineHeight
50380   end if
52000   print #hPdfOut: chr$(27)&"pdf='1,"&background_pdf$&"'";
52020   ! print #hPdfOut: chr$(27)&"&a0v0H"; ! top left  
52040   ! print #hPdfOut: chr$(27)&"position='2,10'";
52060   fn_pr(xLine(1),1350,'Box A: SSN')
52080   fn_pr(xLine(2),yCol(1),'Box B')
52100   fn_pr(xLine(3)+000,yCol(1),'Box C - Line 1')
52120   fn_pr(xLine(3)+110,yCol(1),'Box C - Line 2')
52140   fn_pr(xLine(3)+220,yCol(1),'Box C - Line 3')
52160   fn_pr(xLine(3)+330,yCol(1),'Box C - Line 4')
52180   fn_pr(xLine(3)+440,yCol(1),'Box C - Line 5')
52200   fn_pr(xLine(2),yCol(2),'Box 1')
52220   fn_pr(xLine(2),yCol(3),'Box 2')
52240   fn_pr(xLine(3),yCol(2),'Box 3')
52260   fn_pr(xLine(4),yCol(2),'Box 5')
52280   fn_pr(xLine(4),yCol(3),'Box 6')
52300   fn_pr(xLine(5),yCol(2),'Box 7')
52320   fn_pr(xLine(5),yCol(3),'Box 8')
52340   fn_pr(xLine(6),yCol(1),'Box D Control Number')
52360   fn_pr(xLine(6),yCol(2),'Box 9')
52380   fn_pr(xLine(6),yCol(3),'Box 10')
52400   fn_pr(xLine(7),yCol(1),'Box E')
52420   fn_pr(xLine(7),1550,'last name')
52440   fn_pr(xLine(7),2950,'Suff')
52460   fn_pr(xLine(7),yCol(2),'Box 11')
52480   fn_pr(xLine(7),yCol(3),'Box 12a')
52500   fn_pr(xLine(8),yCol(2)+120,'1')
52520   fn_pr(xLine(8),yCol(2)+470,'2')
52540   fn_pr(xLine(8),yCol(2)+780,'3')
52560   fn_pr(xLine(8),yCol(3),'Box 12b')
52580   fn_pr(xLine(9),yCol(3),'Box 12c')
52600   fn_pr(xLine(10),yCol(3),'Box 12d')
52620   fn_pr(xLine(8)+000,yCol(1),'Box F - Line 1')
52640   fn_pr(xLine(8)+110,yCol(1),'Box F - Line 2')
52660   fn_pr(xLine(8)+220,yCol(1),'Box F - Line 3')
52680   fn_pr(xLine(8)+330,yCol(1),'Box F - Line 4')
52700   fn_pr(xLine(8)+440,yCol(1),'Box F - Line 5')

54000   fn_pr(xLine(11),y2Col(1),'ST1')
54020   fn_pr(xLine(12),y2Col(1),'ST2')
54040   fn_pr(xLine(11),y2Col(2),'Emp State ID 1')
54060   fn_pr(xLine(12),y2Col(2),'Emp State ID 2')
54080   fn_pr(xLine(11),y2Col(3),'Col 3')
54100   fn_pr(xLine(12),y2Col(3),'Col 3')
54120   fn_pr(xLine(11),y2Col(4),'Col 4')
54140   fn_pr(xLine(12),y2Col(4),'Col 4')
54160   fn_pr(xLine(11),y2Col(5),'Col 5')
54180   fn_pr(xLine(12),y2Col(5),'Col 5')
54200   fn_pr(xLine(11),y2Col(6),'Col 6')
54220   fn_pr(xLine(12),y2Col(6),'Col 6')
54240   fn_pr(xLine(11),y2Col(7),'Col 7')
54260   fn_pr(xLine(12),y2Col(7),'Col 7')

58000 fnend
64000 def fn_pr(deciposX,deciposY,text$*256) ! x=up/down, y=left/right
64020   print #hPdfOut: chr$(27)&'&a'&str$(deciposX)&'v'&str$(deciposY)&'H';
64040   print #hPdfOut: text$;
64060 fnend
Attachments
W-2 copy 2.pdf
(50.38 KiB) Downloaded 701 times
W-2 copy 1.pdf
(50.34 KiB) Downloaded 671 times
John Bowman
Post Reply