PrinterLib 1.10

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

PrinterLib 1.10

Post by akee »

Tried to fine the PrinterLib topic but could not find it.

I tried getting the Print Properties window but could not get it running. Then I looked at the code, I am wondering if
PrinterProperties_(0,PrintLib_PH) should be PrinterProperties_(hwnd,PrintLib_PH)?

Code: Select all

ProcedureDLL.l Print_Properties(Window.i)
  If IsWindow(Window)
    hwnd=WindowID(Window)
  Else
    hwnd=0
  EndIf
  ProcedureReturn PrinterProperties_(0,PrintLib_PH)
EndProcedure

ProcedureDLL.l Print_AdvancedProperties(Window.i)
  If IsWindow(Window)
    hwnd=WindowID(Window)
  Else
    hwnd=0
  EndIf
  ProcedureReturn AdvancedDocumentProperties_(0,PrintLib_PH,PrintLib_PN,@dummy,0)
EndProcedure
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PrinterLib 1.10

Post by ABBKlaus »

at first you have to open a printer to get it working :

Code: Select all

OPT$="Orientation=" + Str(#DMORIENT_PORTRAIT) + ","
OPT$+"Papersize="   + Str(#DMPAPER_A4)

If Print_OpenPrinter("",OPT$)
  Print_AdvancedProperties(-1)
  ...
EndIf
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

Thanks ABBKlaus... :)
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

I searched the forums and examples and I have another question...

What is the equivalent of DrawRotatedText() in Printer Lib?

Thanks... :)
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PrinterLib 1.10

Post by ABBKlaus »

akee wrote:What is the equivalent of DrawRotatedText() in Printer Lib?
Its hidden inside the Print_Font() command.

Code: Select all

Print_Font(Font$, Height.l [, Flags.l [, Rotate.l]])

Description:

Changes the current font.

Flags can be a combination of the following :

#PB_Font_Bold
#PB_Font_Italic
#PB_Font_Underline
#PB_Font_StrikeOut
#PB_Font_HighQuality
#PB_Font_HighQuality + 1 = Antialised Quality
#PB_Font_HighQuality + 2 = Cleartype Quality

'Rotate' specifies the angle, in tenths of degrees.
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

Oh ok... Thanks again ABBKlaus... :)
Excellent support... Come to think of it, it is better than Microsoft or Apple... ;p
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

The following code got my laser warmed up but nothing gets printed. :(

Code: Select all

t_printer_title$ = "MyJob"
If Print_OpenPrinter()
  Print_StartDoc(t_printer_title$)
  Print_Font("Calibri", 50)
  Print_WriteStringN(t_printer_title$)
  For a = 1 To 10
    Print_WriteStringN("Line " + Str(a))
  Next
  Print_EndDocPrinter()
EndIf

The Example 02 - Raw Print does the same as well...
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PrinterLib 1.10

Post by ABBKlaus »

I'm guessing you are trying to print some text in raw mode !?
Well the printer only prints something it does understand and i don't know what model you are dealing with and what emulation is neccessary to print in raw mode.

I hope that at least the preview sample prints something ?

BR Klaus
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

The preview is also blank. What I am looking for is to print a list of strings with crlf and then end the document. I'm using FX W3119 laser printer.
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PrinterLib 1.10

Post by ABBKlaus »

have you tried some debug output ? It´s possible that there is an error opening the printer or starting the document.
For the Xerox printer i can´t find any information on the web, can you send me a link or the driver via mail ?

BR Klaus
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

I added some extra code... Using the macro Print_String() below works with Print_StartPrinting() and Print_StopPrinting(). Hmmm...?

Code: Select all

Macro Print_String(CONTENT)
  Print_Text(t_x, t_y, CONTENT)
  t_y = t_y + Print_TextHeight(CONTENT)
EndMacro
FX-W3119 details can e found here... http://www.fujixeroxprinters.com.my/pro ... from=multi
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PrinterLib 1.10

Post by ABBKlaus »

This is a GDI printer, that means you cannot sent binary commands to print plain text :wink:
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

Ok... thanks for note... :)
akee
Enthusiast
Enthusiast
Posts: 475
Joined: Wed Aug 18, 2004 9:52 am
Location: Penang, Malaysia

Re: PrinterLib 1.10

Post by akee »

How do you retrieve the number of copies from the Print Dialog? Thanks.

Image
ABBKlaus
Addict
Addict
Posts: 1143
Joined: Sat Apr 10, 2004 1:20 pm
Location: Germany

Re: PrinterLib 1.10

Post by ABBKlaus »

with a trick :

Code: Select all

Print_PrintDlg(0)
*d.DEVMODE
*d=Print_LoadDEVMODE("")
Debug *d\dmCopies
CallDebugger
Post Reply