Page 2 of 7

Re: PrinterLib 1.10

Posted: Thu Aug 11, 2011 7:28 pm
by akee
Thanks ABBKlaus... ;)

Re: PrinterLib 1.10

Posted: Sat Aug 20, 2011 1:32 am
by akee
If you have 8 pages in a print out and you only want to print page 3-5, how do you use Print_PrintDlg() to get this done. I noticed a procedure Print_SetPRINTDLG(). The documentation is too little to understand. Thanks. :)

Re: PrinterLib 1.10

Posted: Mon Aug 22, 2011 5:30 pm
by ABBKlaus
Using Print_PrintDlg :

Code: Select all

Print_PrintDlg(0,"","","FLAGS=2,NFROMPAGE=2,NTOPAGE=3,NMAXPAGE=999")
BR Klaus

Re: PrinterLib 1.10

Posted: Fri Oct 07, 2011 8:01 pm
by Derren
Hi,
How can get the name of the printer that was selected in Print_PrintDlg(0)
Thank you

Re: PrinterLib 1.10

Posted: Fri Oct 07, 2011 9:49 pm
by ABBKlaus
Try Print_GetPrinterName()

Re: PrinterLib 1.10

Posted: Fri Oct 07, 2011 10:09 pm
by Derren
Thank you.
Great Lib! :)

Re: PrinterLib 1.10

Posted: Tue Oct 25, 2011 3:45 pm
by IdeasVacuum
Similar question but I can't find a structure that holds the value - how do you get the page range from the Printer Dialog? Setting it initially is easy via the Print_PrintDlg options, but if the document is 8 pages and the User opts to print pages 3 to 6 on the dialog, how do we know?

Re: PrinterLib 1.10

Posted: Tue Oct 25, 2011 3:58 pm
by IdeasVacuum
...Still trying to get print spooling to work. If I try:

Code: Select all

Print_StartPrinting(sJobName)
          Print_StartDoc(sJobName)
...I get an IMA: [Error]Invalid memory access (write error at address 0)

If I try Print_StartDoc(sJobName) only, I get a job of zero bytes in the printer queue and my app is frozen.

I'm sure this is all because there are specific ways/sequences in order to use the functions properly, but the example files do not cover spooling.

Re: PrinterLib 1.10

Posted: Tue Oct 25, 2011 7:28 pm
by ABBKlaus
Hi IdeasVacuum,
Similar question but I can't find a structure that holds the value - how do you get the page range from the Printer Dialog? Setting it initially is easy via the Print_PrintDlg options, but if the document is 8 pages and the User opts to print pages 3 to 6 on the dialog, how do we know?
there is a global variable not wrapped to the outside its called PrintLibDLG.PRINTDLG, you could use the following to get the values back :

PrinterLib :

Code: Select all

ProcedureDLL.l Print_GetPrintDlg()
  ProcedureReturn PrintLibDLG
EndProcedure
Sample :

Code: Select all

Print_PrintDlg(0,"","","FLAGS=2,NFROMPAGE=2,NTOPAGE=3,NMAXPAGE=999")
*Test.PRINTDLG=Print_GetPrintDlg()
Debug *Test\nFromPage
Debug *Test\nToPage
*d.DEVMODE
*d=Print_LoadDEVMODE("")
Debug *d\dmCopies
CallDebugger
IdeasVacuum wrote:...Still trying to get print spooling to work. If I try:

Code: Select all

Print_StartPrinting(sJobName)
          Print_StartDoc(sJobName)
...I get an IMA: [Error]Invalid memory access (write error at address 0)

If I try Print_StartDoc(sJobName) only, I get a job of zero bytes in the printer queue and my app is frozen.

I'm sure this is all because there are specific ways/sequences in order to use the functions properly, but the example files do not cover spooling.
The JobID comes with the call to Print_StartPrinting(), Print_StartDoc() is used only for Binary printing.
Why the ima occurs i have no idea (no ima here, but your example is quiet incomplete), the freeze might be due to the printer not beeing online.
I had similar experience with freezes when printers where offline not only with this lib (MS Excel ...) but its only my best guess.
Hope that helps

BR Klaus

Re: PrinterLib 1.10

Posted: Wed Oct 26, 2011 2:33 am
by IdeasVacuum
Hi ABBKlaus, thanks for helping me.

Unfortunately the line Debug *Test\nFromPage Halts execution with [Error] Pointer is null.

Re: PrinterLib 1.10

Posted: Wed Oct 26, 2011 6:19 am
by ABBKlaus
Have you TailBiten the PrinterLib with the command Print_GetPrintDlg() ?
I guess you have only added it to the top of your code, this won't work :wink:
You can also redownload the lib, i have the command already added.

BR Klaus

Re: PrinterLib 1.10

Posted: Wed Oct 26, 2011 10:46 am
by IdeasVacuum
Ah thanks ABBKlaus - I created a DLL and called that :(

In terms of actually printing something, it works very well on a physical printer but the pages are blank if printing to a virtual pdf engine (CutePDF, PDF995).

Code: Select all

             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())

        If Print_PrintDlg(#WinMain,Print_GetDefaultPrinter(),sOpt1,sOpt2)

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

                 Print_OpenPrinter(Print_GetPrinterName())
                 Print_SetUnits(#PRINT_MM)

                 Print_StartPrinting(sJobName)

                 Print_Image(igPP01,0,0,210,297)

                 Print_NewPage()
                 Print_Image(igPP02,0,0,210,297)

                 Print_NewPage()
                 Print_Image(igPP03,0,0,210,297)

                 Print_NewPage()
                 Print_Image(igPP04,0,0,210,297)

                 Print_StopPrinting()
        EndIf
...using images because the app is 'filling in' scanned forms.

Re: PrinterLib 1.10

Posted: Wed Oct 26, 2011 4:16 pm
by ABBKlaus
Do you have those images somewhere for download ?
Might be the imagesize that does not fit :?

Re: PrinterLib 1.10

Posted: Wed Oct 26, 2011 4:39 pm
by IdeasVacuum
...not sure, given that it does actually print perfectly to a physical printer, but do you think it has something to do with PDF, i.e. the image size cannot be exactly the same as PDF page size (A4, 210x297mm)? I'm going to experiment with the image size because I just discovered that the PurePDF lib also creates blank files with these images (using code that is identical to an older app that does not have this issue).

Re: PrinterLib 1.10

Posted: Wed Oct 26, 2011 4:50 pm
by IdeasVacuum
.....Whoa, that is it - the images are size A4 and size A4 images do not fit on a PDF A4 page apparently! That is definitely going to be painful. I will have to work out exactly how much smaller the images need to be, I just clipped one by 10 pixels all-round for this test.