How do you connect the printer and pass data using Visual FoxPro scripting Language?
Please suggest steps and sample code.
How do you connect the printer and pass data using Visual FoxPro scripting Language?
Please suggest steps and sample code.
Hi T,
Go to this page: https://www.lianja.com/doc/index.php...ds#Text_Output
and go to the Reports and Printing section
Basically, you can take what you want to print, stick it in a text file, and print the file.
There are options to achieve the same result, of course.
Hank
Thanks for the replay.
It does not work printFile().
I have already tried the below code but it does not work. Please help.
local filename = "C:\\lianja\\installers\\dd2.PNG"
local printerName = "EPSON TM-m30 Receipt"
local numberOfCopies = 1
local orientation = "Landscape"
Lianja.printFile(filename, printerName, numberOfCopies, orientation);
Last edited by MoonT; 2024-05-27 at 08:02.
See the doc
https://www.lianja.com/doc/index.php...hods#printFile
- Args
printer as Character, filename as Character
Try printing a small text file NOT an image.
Principal developer of Lianja, Recital and other products
Follow me on:
Twitter: http://twitter.com/lianjaInc
Facebook: http://www.facebook.com/LianjaInc
LinkedIn: http://www.linkedin.com/in/barrymavin
There are many alternative ways of printing in LianjaScript/VFP.
The traditional way in VFP is:
This is just for printing plain text.Code:// // output text to a file then print it // set printer to barry.txt set print on set console off ? "hello world" set print off set printer to set console on Lianja.printFile("printername", "barry.txt") // // open the printer port directly // set printer to com2: set print on set console off ? "hello world" set print off set printer to set console on
If you want to print a formatted receipt with logo and different fonts in a printer independent manner then generate HTML and use Lianja.printHtml().
Last edited by barrymavin; 2024-05-27 at 22:22.
Principal developer of Lianja, Recital and other products
Follow me on:
Twitter: http://twitter.com/lianjaInc
Facebook: http://www.facebook.com/LianjaInc
LinkedIn: http://www.linkedin.com/in/barrymavin
Thanks for reply
where is this file "barry.txt"
Need to set any specific path?
Please guide.
It is created in the current directory you are working in.
Principal developer of Lianja, Recital and other products
Follow me on:
Twitter: http://twitter.com/lianjaInc
Facebook: http://www.facebook.com/LianjaInc
LinkedIn: http://www.linkedin.com/in/barrymavin
Thanks for replay
I try with the below code but not working.
set printer to "C:\\lianja\\installers\\d1.txt"
set print on
set console off
? "hello world"
set print off
set printer to
set console on
Lianja.printFile("EPSON TM-m30 Receipt", "C:\\lianja\\installers\\d1.txt")
Please suggest if anything missing.
My printer port is "ESDPRT001"
Last edited by MoonT; 2024-05-28 at 03:10.
Please stop cross posting in different places.
Look at
https://learn.microsoft.com/en-us/wi...commands/print
and verify from the command line.
Principal developer of Lianja, Recital and other products
Follow me on:
Twitter: http://twitter.com/lianjaInc
Facebook: http://www.facebook.com/LianjaInc
LinkedIn: http://www.linkedin.com/in/barrymavin
Thanks for replay
Please find attached file.
![]()
Bookmarks