Hi all.
I can't set and keep the default printer for my app.
When I set the printer with oPrinter:Setup() the set printer is seen correctly with oPrinter:Device but not with oReport:PrinterDevice:printername and the same by choosing the print icon from the preview window (it is always set Microsoft print to PDF).
The app's default printer doesn't necessarily have to be the same as in Windows.
So I save the chosen default printer on file (with oPrinter:Device) but then I can't set it to be used every time within the app.
How should I do?
Thank you for your suggestion.
RP2: Default printer - Solved in xSharp
Moderator: wriedmann
RP2: Default printer
Hello,
I use
[left]oReport:PrinterDevice:SetPrinterByName(cPrinter)[/left]
where cPrinter is passed by the program (I keep the preferred printername in the program's settings).
If this is not done, I'd indeed expect Windows default printer, which for me is Microsoft Print to PDF too (and I see that appear in other programs which do not have their own printer settings). I use this printer to prevent accidentally filling the printer queue and then printing pages with some test stuff when I am about to really print something (else), often weeks later.
Dick
I use
[left]oReport:PrinterDevice:SetPrinterByName(cPrinter)[/left]
where cPrinter is passed by the program (I keep the preferred printername in the program's settings).
If this is not done, I'd indeed expect Windows default printer, which for me is Microsoft Print to PDF too (and I see that appear in other programs which do not have their own printer settings). I use this printer to prevent accidentally filling the printer queue and then printing pages with some test stuff when I am about to really print something (else), often weeks later.
Dick
RP2: Default printer
Thank you Dick for your suggestion:
I choose the printer with oPrinter:Setup(), save PrinterName with oPrinter:Device and, when I have to print, I use oReport:PrinterDevice:SetPrinterByName(cPrinter) and everything works fine!
When I want to change the default printer again, oPrinter:Setup() always selects Microsoft Print to PDF: how do I select my previous printer?
gfb
I choose the printer with oPrinter:Setup(), save PrinterName with oPrinter:Device and, when I have to print, I use oReport:PrinterDevice:SetPrinterByName(cPrinter) and everything works fine!
When I want to change the default printer again, oPrinter:Setup() always selects Microsoft Print to PDF: how do I select my previous printer?
gfb
gfb
RP2: Default printer
Hello,
I am not sure I completely understand your question but maybe this code helps. IC2GetAppObject is an implementation of GetAppObject but you could use any source of storing and retrieving the variable.
Dick
I am not sure I completely understand your question but maybe this code helps. IC2GetAppObject is an implementation of GetAppObject but you could use any source of storing and retrieving the variable.
Dick
Code: Select all
METHOD FilePrinterSetup() CLASS IC2StSh
//#s Global setup for printer 09-11-2009
LOCAL oPrinter AS PrintingDevice
LOCAL cPrinter AS STRING
oPrinter := PrintingDevice{IC2GetAppObject():cSessionPrinter}
oPrinter:Setup()
cPrinter:=oPrinter:Device
IC2GetAppObject():cSessionPrinter:=cPrinter // assign to global object
WriteIC2Reg("cDefaultPrinter",cPrinter) // Write last selected printer to retrieve next time 12-8-2010
RETURN NIL
RP2: Default printer
Hi Dick,
what doesn't work is:
oPrinter := PrintingDevice{<cPrinterName>}
For example:
oPrinter := PrintingDevice{"Microsoft XPS Document Writer"} does not set up the printer and oPrinter: device still returns "Microsoft Print to PDF" (and the same in oPrinter:Setup() )
what doesn't work is:
oPrinter := PrintingDevice{<cPrinterName>}
For example:
oPrinter := PrintingDevice{"Microsoft XPS Document Writer"} does not set up the printer and oPrinter: device still returns "Microsoft Print to PDF" (and the same in oPrinter:Setup() )
gfb
RP2: Default printer
Hi Gian,
Is this with the VO or the X# version of RP2?
Can you please create and send a very small test app showing exactly what you are doing?
.
Is this with the VO or the X# version of RP2?
Can you please create and send a very small test app showing exactly what you are doing?
.
Chris Pyrgas
XSharp Development Team
chris(at)xsharp.eu
XSharp Development Team
chris(at)xsharp.eu
RP2: Default printer
Hello Gian,
IC2StSh is my subclass of shellwindow, via some more subclasses. You could put it in any of your classes. The above method worked for me in VO, I do not use ReportPro in X# but we have 1 application converting (Frank is working on that) - not sure if that program uses this too.
Did you eventually try the full code, when you concluded it didn't work?
Dick
IC2StSh is my subclass of shellwindow, via some more subclasses. You could put it in any of your classes. The above method worked for me in VO, I do not use ReportPro in X# but we have 1 application converting (Frank is working on that) - not sure if that program uses this too.
Did you eventually try the full code, when you concluded it didn't work?
Dick
RP2: Default printer - Solved in xSharp
It's a curious fact:
in my latest version I changed some things: in xSharp it works, while in VO oPrinter:Setup() still doesn't take the previously selected printer....
However, I share a small test app because it may be of interest to others:
1) Test-AEF (the app)
2) Test-Dir&File.zip (Folder c:test with .dbf and .rpt files)
Thanks so much to Dick and Chris for the tips and patience.
in my latest version I changed some things: in xSharp it works, while in VO oPrinter:Setup() still doesn't take the previously selected printer....
However, I share a small test app because it may be of interest to others:
1) Test-AEF (the app)
2) Test-Dir&File.zip (Folder c:test with .dbf and .rpt files)
Thanks so much to Dick and Chris for the tips and patience.
- Attachments
-
- Test-AEF.zip
- (586.51 KiB) Downloaded 200 times
-
- Test-Dir&File.zip
- (2.15 KiB) Downloaded 176 times
gfb