Insert graphic into printout?

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
cj
Posts: 17
Joined: Tue Aug 15 2006

Insert graphic into printout?

Post by cj »

I have a legacy Visual FoxPro program (code sample below) that I need to modify. The printout now being produced needs what we believe would be best inserted as a graphic added in the middle of page one.

I don't think FoxPro will do that on it's own but I'm hoping the Amyuni PDF Converter 2.06 we have will do this. Can someone tell me if it can and where to get started?

Code: Select all

SET PRINT ON
SET DEVI TO PRINT
pdf=CREATEOBJECT("cdintf.cdintf")
pdf.driverinit("Amyuni PDF Converter")
pdf.filenameoptions=1+2+16+128
pdf.defaultfilename="c:\test.pdf"
SET PRINTER TO NAME "Amyuni PDF Converter"
SET MEMOWIDTH TO 80

* --- Print Page Header
SET PRINTER FONT 'Arial',14 STYLE "B"
@ 1,79 say '_____'

SET PRINTER FONT 'Arial',12
@ 3,10 SAY 'Account #:  1234567890'
@ 3,75 SAY 'Invoice #:    123456'
SET PRINTER FONT 'Arial',12 STYLE "B"
@ 3,93 say '_____'

SET PRINTER FONT 'Arial',12
@ 4,10  SAY 'Page 1'
@ 4,75 SAY 'Bill Date:    01/01/1980'

@ 10,19 SAY 'Homer Simpson'
@ 11,19 SAY '59 Evergreen Terrace'
@ 12,19 SAY 'Springfield'

SET PRINTER FONT "Arial",10
@ 21,35 SAY "Plus Payments"
@ 21,60 SAY "Less"
@ 21,85 SAY "Ending"
@ 21,100 SAY "Estimated # of"
SET PRINTER FONT "Arial",10 STYLE "U"
@ 22,12 SAY 'Previous Balance'
@ 22,36 SAY "    Received    "
@ 22,55 SAY 'Current Charges'
@ 22,83 SAY '  Balance  '
@ 22,100 SAY 'Calls Available'
SET PRINTER FONT "Arial",10

* --- Prev. Balance
@ 23,17 SAY '15.32'

* --- Payments Rec'd
@ 23,40 SAY '50.00'

* --- Curr. Charges
@ 23,60 SAY '-45.63'

* --- Ending Balance
@ 23,87 SAY '19.69'

*************** INSERT GRAPHIC HERE **************

SET PRINTER FONT "Arial",6
@ 42,12 SAY '- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'+;
' - - - - - - - - - - - Please Cut Here and Return Top Portion With Payment - -'+;
' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -'

eject

SET PRINT ON
SET DEVI TO PRINT
pdf=CREATEOBJECT("cdintf.cdintf")
pdf.driverinit("Amyuni PDF Converter")
pdf.filenameoptions=1+2+16+128
pdf.defaultfilename="c:\DeleteThisFile.pdf"
SET PRINTER TO NAME "Amyuni PDF Converter"
SET MEMOWIDTH TO 80
EJECT

SET PRINTER TO
SET PRINT OFF
SET DEVICE TO SCREEN
RETURN
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

From the code above i see that you are printing each statement directly to the printer.

What you can do is create the full report in VFP along with the text and the graphic and then print all that report to the PDF Printer to turn in in PDF format.

Hope this helps.
cj
Posts: 17
Joined: Tue Aug 15 2006

Post by cj »

Maybe, course you don't say how to put the graphic in it that way either. Also keep in mind not everything changes just because there is a new way to do it. This program has been around for ages and it is unlikely mgt will commit the time to rework it to print a new way. Sorry, but I'm getting tired of being told that is an old way of printing. It is the way this is being done like it or not. Can anyone help with inserting a graphic into this sample code?
cj
Posts: 17
Joined: Tue Aug 15 2006

Post by cj »

How about inserting it as a watermark? Would that work?
I'm trying to figure out how to enable watermarks now. It would need to be first page only. Any ideas?
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

I tried to google your issue a little bit but i didn't find a way to insert a picture in FoxPro while sending it to the printer. I am sure there should be a way however, and if a FoxPro developer who knows this come across this message i hope he or she will shed some light on this. Maybe posting this question to a FoxPro forum will help too.

What you can do is convert your picture to PDF by printing it to the PDF Printer and then merge the PDF with the picture in it with the PDF with text in it using the Merge() or MergeEx() function of CDIntf. If this solution seems feasible please take a look at "Common Driver Interface 250.pdf" for more information about the functions i mentioned.

Hope this helps.
cj
Posts: 17
Joined: Tue Aug 15 2006

Post by cj »

Yes, merge is my second option. Second only because I'd have to close the file, open it again and append in the pdf/image then reopen it to continue writing it. The image goes in the middle of the first page.

I am still wondering....Can I add a pdf of this image as a watermark? I could swear I read somwhere I could use a pdf as a watermark. Now I can't find it.
cj
Posts: 17
Joined: Tue Aug 15 2006

Post by cj »

Can you tell me what this line is saying:

filenameoptions=1+2+16+128

I know what 1 and 2 are but I can't find references to 16 and 128.
I asked around here but nobody seems to remember.
cj
Posts: 17
Joined: Tue Aug 15 2006

Post by cj »

Joan, at the risk of driving you crazy with my questions...

In "Amyuni PDF Converter.PDF" that we have with our software I found under "What's new in version 2" that "PDF documents can be watermarked using....another PDF file...." I have obtained my graphic in a PDF. Now to figure out how to specify to use it when printing the report. I have not found a programming example of doing this.

And I still really want to know about those filenameoptions values. I see the list in "Appendix D: FileNameOptions values" in the same PDF documentation but I can't come up with 16 or 128 anyway. I'm sure the author of this program didn't pull those numbers out of thin air.

Thanks for your help!
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello CJ,

You can add a PDF file as watermark. mainly this is merging the pdf file containing the watermark with the original pdf document.

You can use the Merge or MergeEx function to do that. For more information please check "Common Driver Interface.pdf" that you get with your driver, this contains the Developer documentation for the version of the PDF Converter you are currently using.

I replied to your FileNameOptions value in your other post.

Hope this helps.
Post Reply