FBWinPrint 0.10
FBWinPrint uses the Windows API so I would think it would not matter as long as the printer works from your system. There may be issues with scaling your images that the original version does not take into account. Look further down the thread for a solution for that.phishguy wrote:I tried FBWinPrint with the first example on a network attached printer. The printer dialog comes up fine, I select the printer, and then it finishes normally. However, nothing ever appears on the printer. Will this program work with network attached printers?
-Vince
See:phishguy wrote:I also tried the code from Antoni. It didn't print either. I did notice his code displays the printer path and it seems like the end of the printer path/name is truncated. Perhaps there isn't enough string space allocated.
Code: Select all
Function PrinterObj.Dialog() As String
Dim PName As ZString *60
Prob should be MAX_PATH.
Last edited by Zippy on Jan 30, 2010 17:54, edited 1 time in total.
@ZippyZippy wrote:@Vince
Is there a simple method or can you add the facility to bypass the printer dialog to let the print go to the defualt printer without user intervention?
There is no need to call the printer dialog method unless you want to change printer settings. The handle to the printer will be the one set as default.
Also, I translated a function from Microsoft to send raw data to a printer. I posted it to the Beginner forum in response to someone wanting to do that.
-Vince
I tested using GetDefaultPrinter and a network printer with a longer name:
\\Zippy\hp deskjet 5550 series on Zippy
[That's really the \\host\printer name. Heh.]
and it truncates to 30 characters using this code:
leaving pname as:
\\Zippy\hp deskjet 5550 series
I can't test-print to that network printer ATM , unfortunately (other problems).
\\Zippy\hp deskjet 5550 series on Zippy
[That's really the \\host\printer name. Heh.]
and it truncates to 30 characters using this code:
Code: Select all
#include once "windows.bi"
#include once "win/winspool.bi"
dim pname as zstring *120
dim n as integer
getdefaultprinter(null,@n)
print "Need: ";n
'
getdefaultprinter(@pname,@n)
print pname,len(pname),n
sleep
\\Zippy\hp deskjet 5550 series
I can't test-print to that network printer ATM , unfortunately (other problems).
UPDATE!
Download FBWinPrint
Special thanks to Antoni for adding the image scaling!'************************************************************************
' FBWinPrint v 0.14 - Windows Printing Library for FreeBASIC
' by Vincent DeCampo
'
' Rev 0.14 (01/30/2010)
'
' - Increased length of printer pathname to MAX_PATH
' - Added routines to send raw data to printer
'
' Rev 0.13 - Mods by Antoni 10/19/2009
'
' - Corrected bug with PrintBox color
' - Changed PageWidth and PageHeight properties to use the printable size of the sheet
' - Addded scaling to PrintBox, PrinBMP and PrintWindow to make them printer independent
' - Tested with HP4000 and Panasonic DPC322 printers and PDF and Djvu converters
Download FBWinPrint