It is currently Sat May 25, 2013 4:50 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: PrinterLib 1.10
PostPosted: Wed Oct 26, 2011 5:11 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
The image needs to be around 2mm smaller (Width and Height) than the page (approx 9pix smaller). Strange but true - even if I could ask Adobe for the logic behind that, I probably would not want to :)

Thank you again for your help ABBKlaus.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Wed Oct 26, 2011 10:11 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
....another odd thing though is that 32bit images fail. 24bit is fine and that is all I need anyway, no doubt useful info for others though.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Sat Feb 11, 2012 5:53 pm 
Offline
Addict
Addict

Joined: Tue May 06, 2003 5:07 pm
Posts: 2258
Location: UK
Any chance for a cross platform version of this? :)


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Sat Feb 11, 2012 11:28 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
Quote:
Any chance for a cross platform version of this?

It is using a Windows API, so that is unlikely.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Tue Aug 28, 2012 12:14 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 31, 2006 4:34 am
Posts: 427
Hi ABBKlaus
I really appreciate your library, and use it a lot in my programs.
But recently I saw need to be able to check the status of the list of installed printers,
so as to indicate any that were not available for use in the selection.
For example: printer is turned off, out of paper, paper jammed, out of ink, etc.
I tried using your Print_GetStatus(#PRINT_STATUS) to try to get that info, but all I get is
status = 0,
and Debug Print_GetLastError() always gives the message:
"The data area passed to a system call is too small" , even on valid online printers.
When I use the #PRINT_ATTRIBUTES type, it works fine. Different attributes are listed.
(I'm using PB4.61 on XP Pro)

I think I'm using the command right, but if not, could you please correct me as to
what I'm doing wrong? Thank you very much for any help or ideas.

I used the following code for trying to get this info.
I select the test printer by commenting or un commenting out.

Code:
selprn$="Canon i550"  ;valid printer  but turned off
;selprn$="WorkForce 610(Network)"  ;valid network printer  online and working
;selprn$="Brother HL-1440 series"  ;valid network printer  out of paper
;selprn$="false printer test"

If Print_OpenPrinter(selprn$,"PAPERSIZE="+Str(#DMPAPER_LETTER)+",ORIENTATION="+Str(#DMORIENT_PORTRAIT),#PRINTER_ALL_ACCESS)
  status=Print_GetStatus(#PRINT_STATUS)
  If status<>0
    If status & #PRINTER_STATUS_BUSY
      Debug "#PRINTER_STATUS_BUSY"
    EndIf
    If status & #PRINTER_STATUS_DOOR_OPEN
      Debug "#PRINTER_STATUS_DOOR_OPEN"
    EndIf
    If status & #PRINTER_STATUS_ERROR
      Debug "#PRINTER_STATUS_ERROR"
    EndIf
    If status & #PRINTER_STATUS_INITIALIZING
      Debug "#PRINTER_STATUS_INITIALIZING"
    EndIf
    If status & #PRINTER_STATUS_IO_ACTIVE
      Debug "#PRINTER_STATUS_IO_ACTIVE"
    EndIf
    If status & #PRINTER_STATUS_MANUAL_FEED
      Debug "#PRINTER_STATUS_MANUAL_FEED"
    EndIf
    If status & #PRINTER_STATUS_NO_TONER
      Debug "#PRINTER_STATUS_NO_TONER"
    EndIf
    If status & #PRINTER_STATUS_NOT_AVAILABLE
      Debug "#PRINTER_STATUS_NOT_AVAILABLE"
    EndIf
    If status & #PRINTER_STATUS_OFFLINE
      Debug "#PRINTER_STATUS_OFFLINE"
    EndIf
    If status & #PRINTER_STATUS_OUT_OF_MEMORY
      Debug "#PRINTER_STATUS_OUT_OF_MEMORY"
    EndIf
    If status & #PRINTER_STATUS_OUTPUT_BIN_FULL
      Debug "#PRINTER_STATUS_OUTPUT_BIN_FULL"
    EndIf
    If status & #PRINTER_STATUS_PAGE_PUNT
      Debug "#PRINTER_STATUS_PAGE_PUNT"
    EndIf
    If status & #PRINTER_STATUS_PAPER_JAM
      Debug "#PRINTER_STATUS_PAPER_JAM"
    EndIf
    If status & #PRINTER_STATUS_PAPER_OUT
      Debug "#PRINTER_STATUS_PAPER_OUT"
    EndIf
    If status & #PRINTER_STATUS_PAPER_PROBLEM
      Debug "#PRINTER_STATUS_PAPER_PROBLEM"
    EndIf
    If status & #PRINTER_STATUS_PAUSED
      Debug "#PRINTER_STATUS_PAUSED"
    EndIf
    If status & #PRINTER_STATUS_PENDING_DELETION
      Debug "#PRINTER_STATUS_PENDING_DELETION"
    EndIf
    If status & #PRINTER_STATUS_POWER_SAVE
      Debug "#PRINTER_STATUS_POWER_SAVE"
    EndIf
    If status & #PRINTER_STATUS_PRINTING
      Debug "#PRINTER_STATUS_PRINTING"
    EndIf
    If status & #PRINTER_STATUS_PROCESSING
      Debug "#PRINTER_STATUS_PROCESSING"
    EndIf
    If status & #PRINTER_STATUS_SERVER_UNKNOWN
      Debug "#PRINTER_STATUS_SERVER_UNKNOWN"
    EndIf
    If status & #PRINTER_STATUS_TONER_LOW
      Debug "#PRINTER_STATUS_TONER_LOW"
    EndIf
    If status & #PRINTER_STATUS_USER_INTERVENTION
      Debug "#PRINTER_STATUS_USER_INTERVENTION"
    EndIf
    If status & #PRINTER_STATUS_WAITING
      Debug "#PRINTER_STATUS_WAITING"
    EndIf
    If status & #PRINTER_STATUS_WARMING_UP
      Debug "#PRINTER_STATUS_WARMING_UP"
    EndIf
  Else   
    Debug Print_GetLastError()
    ;I always get the message:    The data area passed to a system call is too small.
  EndIf
Else
  Debug Print_GetLastError()
EndIf



Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Tue Aug 28, 2012 11:07 am 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1069
Location: Germany
yrreti wrote:
Hi ABBKlaus
I really appreciate your library, and use it a lot in my programs.
But recently I saw need to be able to check the status of the list of installed printers,
so as to indicate any that were not available for use in the selection.
For example: printer is turned off, out of paper, paper jammed, out of ink, etc.
I tried using your Print_GetStatus(#PRINT_STATUS) to try to get that info, but all I get is
status = 0,
and Debug Print_GetLastError() always gives the message:
"The data area passed to a system call is too small" , even on valid online printers.
When I use the #PRINT_ATTRIBUTES type, it works fine. Different attributes are listed.
(I'm using PB4.61 on XP Pro)

I think I'm using the command right, but if not, could you please correct me as to
what I'm doing wrong? Thank you very much for any help or ideas.

Hi yrreti,
you are doing nothing wrong, status = 0 means there is no status available (offline or virtual printer).
The errormessage you are retrieving is normal because i do not reset the last error, it comes from the call to GetPrinter_() to get the correct buffersize.

I think you should have a look into "Example07 Get Printer Status.pb", it works here perfectly with a "HP Officejet Pro 8500 A910".

Code:
Printer-Lib Version V1.10
PureBasic Version 461
Printer : HPD134CF (HP Officejet Pro 8500 A910)
OpenPrinter_()=1
Print_SetTextAlign(0)
SetTextAlign_(4211253,0)=0
Print_SetBkMode(1)
SetBkMode_(4211253,1)=2
Print_SetLineColor(0)
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,18FEFC,0,0)=EE501649
Print_CreateBrush(0)
CreateSolidBrush_(0)=FF101451
Print_CreatePen(12200,0,0,0,0)
ExtCreatePen_(12200,5,18FF04,0,0)=835013CC
Status=16
Attribute=2624
#PRINTER_STATUS_PAPER_OUT
#PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST
#PRINTER_ATTRIBUTE_ENABLE_BIDI
#PRINTER_ATTRIBUTE_LOCAL

BR Klaus

_________________
http://www.PureBasicPower.de


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Tue Aug 28, 2012 1:58 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 31, 2006 4:34 am
Posts: 427
Thanks for the reply and the explanation about the error message.
I saw in your comments, that you do have a status message listed.
But I am puzzled? I am using the code from your "Example07 Get Printer Status.pb"
I just added the printer name in selprn$ so I could test my different printers, and didn't use the
attr=Print_GetStatus(#PRINT_ATTRIBUTES) part of the code, also to make the pasted code
here smaller. But even when I use the complete Example07, except for adding the printer names,
I still don't get any status? I do get the attribute messages fine, just no status messages?
Closer examination revealed that I'm using a Virtual printer port for usb for the Canon printer,
with printer pooling unchecked.
One thing I did notice though, is that with the Canon printer turned off, I get the attr message:
[07:09:54] #PRINTER_ATTRIBUTE_WORK_OFFLINE . So I thought that maybe I could just use
that. But with the Brother printer turned off, I get no change? It is connected with a lan server.
The WorkForce printer is connected by wifi, and shows no change either?
Is there anything I could possibly check? Why it works with your printer and not mine is really
puzzling. I did try reinstalling and using your latest Printer_lib1.10 to eliminate problems there,
but there was no change. If there is a problem with the code somewhere, it definitely would be
nice to get this part fixed if possible, but even if not, I really do like your programs!
Thanks for your help and reply.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Sun Sep 09, 2012 2:24 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
Hi
Still having issues getting the info set by the User via the printer dialog:
Code:
#Win = 0

   sOpt1.s = "ORIENTATION=" + Str(#DMORIENT_PORTRAIT) + Chr(44) + "PAPERSIZE=" + Str(#DMPAPER_A4) + Chr(44) + "PAPERLENGTH=297" + Chr(44) + "PAPERWIDTH=210" + Chr(44) + "SCALE=1" + Chr(44) + "COPIES=1" + Chr(44) + "DEFAULTSOURCE=" + Str(#DMBIN_AUTO) + Chr(44) + "PRINTQUALITY=" + Str(#DMRES_HIGH) + Chr(44) + "COLOR=" + Str(#DMCOLOR_COLOR) + Chr(44) + "COLLATE=" + Str(#DMCOLLATE_TRUE)
   sOpt2.s = "FLAGS=" + "NFROMPAGE=1" + Chr(44) + "NTOPAGE=" + Str(igPageCnt) + Chr(44) + "NMINPAGE=1" + Chr(44) + "NMAXPAGE=999" + Chr(44) + "NCOPIES=1"
sJobName.s = "PP_" + Str(Date())

        hDC = Print_PrintDlg(#Win,Print_GetDefaultPrinter(),sOpt1,sOpt2)

                 *PrintInfo.PRINTDLG = Print_GetPrintDlg()
                 Debug *PrintInfo\nFromPage
                 Debug *PrintInfo\nToPage
                 Debug *PrintInfo\nCopies
                 Debug Print_GetPrinterName()
                 Debug GetDeviceCaps_(hDC,#HORZRES)
                 Debug GetDeviceCaps_(hDC,#VERTRES)
                 Debug Print_GetDeviceCaps(#HORZRES)
                 Debug Print_GetDeviceCaps(#VERTRES)

End

In the above example, *PrintInfo\nCopies always returns 1 and Print_GetPrinterName() always returns the default printer, not the printer selected in the dialog? Also GetDeviceCaps always returns 0.
I see from your website that you have made a non-tail-bitten version available, but that does not have Print_GetPrintDlg(). As only an occasional user of the PrinterLib, I get myself horribly confused!

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Sun Sep 09, 2012 2:54 am 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
Still can't get the selected printer, but I can get the DC vals:
Code:
#Win = 0
#Prt = 1

If OpenWindow(#Win,0,0,200,200,"Test",#PB_Window_SystemMenu|#PB_Window_TitleBar)

         sOpt1.s = "ORIENTATION=" + Str(#DMORIENT_PORTRAIT) + Chr(44) + "PAPERSIZE=" + Str(#DMPAPER_A4) + Chr(44) + "PAPERLENGTH=297" + Chr(44) + "PAPERWIDTH=210" + Chr(44) + "SCALE=1" + Chr(44) + "COPIES=1" + Chr(44) + "DEFAULTSOURCE=" + Str(#DMBIN_AUTO) + Chr(44) + "PRINTQUALITY=" + Str(#DMRES_HIGH) + Chr(44) + "COLOR=" + Str(#DMCOLOR_COLOR) + Chr(44) + "COLLATE=" + Str(#DMCOLLATE_TRUE)
         sOpt2.s = "FLAGS=" + "NFROMPAGE=1" + Chr(44) + "NTOPAGE=" + Str(igPageCnt) + Chr(44) + "NMINPAGE=1" + Chr(44) + "NMAXPAGE=999" + Chr(44) + "NCOPIES=1"
      sJobName.s = "PP_" + Str(Date())

             hDC = Print_PrintDlg(#Prt,Print_GetDefaultPrinter(),sOpt1,sOpt2)

                 *PrintInfo.PRINTDLG = Print_GetPrintDlg()
                 Debug *PrintInfo\nFromPage
                 Debug *PrintInfo\nToPage
                 Debug *PrintInfo\nCopies
                 Debug Print_GetPrinterName()

                 hDC = Print_OpenPrinter(Print_GetPrinterName())
                 Debug Print_GetPrinterName()
                 Debug GetDeviceCaps_(hDC,#HORZRES)
                 Debug GetDeviceCaps_(hDC,#VERTRES)
                 Debug Print_GetDeviceCaps(#HORZRES)
                 Debug Print_GetDeviceCaps(#VERTRES)

EndIf

End

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Sun Sep 09, 2012 8:07 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
If you Google it, you will find there are a number of discussions about the MS PrintDlg() function. MSDN itself recommends using PrintDlgEx or PageSetupDialog(). According to the various discussions, it seems that the example published by MS does not work correctly - certainly sounds plausible since the example is no longer available.

Concerning the number of printed copies thing, this is a known issue: If PD_RETURNDC is set but PD_USEDEVMODECOPIESANDCOLLATE flag is not set, the PrintDlgEx and PrintDlg functions return an incorrect number of copies. To get the correct number of copies, ensure that the calling application always uses PD_USEDEVMODECOPIESANDCOLLATE with PD_RETURNDC. I suspect that maybe the printer lib does not use the flag PD_USEDEVMODECOPIESANDCOLLATE, for two reasons - firstly, it is listed in some places as having the same value as PD_USEDEVMODECOPIES, and secondly it's not recognized by PB.

Edit: nCopies contains the number of copies if the printer driver does not support multiple copies. Otherwise it is set to one. So in fact it is working correctly - if the driver handles multiple copies, nCopies = 1 and the app just needs to send the document once. If the driver does not support multi-copies, nCopies returns the number of copies selected by the User and the app must send the document n times to make copies.

So, I am nearing to the conclusion that I may have to write my own dialog instead, though I really don't want to! I'm wondering if that should be as a separate app, because if it were coded in another language it could be cross-platform. I wonder how Adobe does it for PDF for example.... up till now, my use of PrintLib had been for my work only when printing to a device, else I have been printing to a PDF engine and that works well on my machine because the engine is the default printer and I am only printing images.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Fri Sep 14, 2012 10:58 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
Print_GetPrinterName() always fails on my PC, but the following procedure by netmaestro works perfectly:
Code:
Procedure.s GetSelectedPrinter()
;-------------------------------
  Protected sPrinterName.s, PrintDlg.PRINTDLG, *DEVNAMES.DEVNAMES

  With PrintDlg

          \lStructSize = SizeOf(PRINTDLG)
                \Flags = #PD_ALLPAGES
  EndWith

  PrintDlg_(PrintDlg)

  *DEVNAMES = GlobalLock_(PrintDlg\hDevNames)
  sPrinterName = PeekS(*DEVNAMES + (*DEVNAMES\wDeviceOffset * SizeOf(Character))) ;wDeviceOffset is in characters, not bytes

  GlobalUnlock_(PrintDlg\hDevNames)
    GlobalFree_(PrintDlg\hDevNames)

  ProcedureReturn sPrinterName

EndProcedure


Edit: The cause of Print_GetPrinterName() failing is Compiler Unicode Mode :?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Last edited by IdeasVacuum on Sat Sep 15, 2012 1:46 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Fri Sep 14, 2012 11:46 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
IMA:

Print_AdvancedProperties(Win.i) pops-up the current printer's advanced properties panel correctly, but if the User clicks the OK button on that form, it crashes.

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Wed Jan 02, 2013 7:14 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
Hi ABBKlaus

Quick question:

Print_Image(Imagenr.l, x.f, y.f [, w.f, h.f])

What units of measure are those float values meant to be in?

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Wed Jan 02, 2013 7:58 pm 
Offline
Addict
Addict

Joined: Sat Apr 10, 2004 1:20 pm
Posts: 1069
Location: Germany
If i remember correctly it defaults to mm, if you havent used Print_SetUnit() before.

_________________
http://www.PureBasicPower.de


Top
 Profile  
 
 Post subject: Re: PrinterLib 1.10
PostPosted: Sun Jan 06, 2013 10:04 pm 
Offline
Addict
Addict

Joined: Fri Oct 23, 2009 2:33 am
Posts: 2865
Location: Wales, UK
Thanks ABBKlaus, your memory is indeed in good working order!

_________________
IdeasVacuum
If it sounds simple, you have not grasped the complexity.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 45 posts ]  Go to page Previous  1, 2, 3

All times are UTC + 1 hour


Who is online

Users browsing this forum: Fred, jackymb, mevedia.de, rchockxm and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye