Real Software Forums
http://forums.realsoftware.com/

Printing Way this no works
http://forums.realsoftware.com/viewtopic.php?f=10&t=47901
Page 1 of 1

Author:  jetpr [ Thu May 16, 2013 8:56 pm ]
Post subject:  Printing Way this no works

Dim ps As PrinterSetup

Settings ="DoNotAlterThis=SetupString.2"_
+EndOfLine+"ActualHorizontalResolution=203"_
+EndOfLine+"ActualVerticalResolution=203"_
+EndOfLine+"MaxHorizontalResolution=300"_
+EndOfLine+"MaxVerticalResolution=300"_
+EndOfLine+"MarginLeft=0"_
+EndOfLine+"MarginRight=14376"_
+EndOfLine+"MarginTop=0"_
+EndOfLine+"MarginBottom=0"_
+EndOfLine+"MinMarginLeft=0"_
+EndOfLine+"MinMarginRight=14376"_
+EndOfLine+"MinMarginTop=0"_
+EndOfLine+"MinMarginBottom=0"_
+EndOfLine+"PageSetupFlags=6"_
+EndOfLine+"DevModeStructureSizePS=1044"_
+EndOfLine+"DevModeStructurePS=Star TSP100 Tear Bar (TSP113)"

ps=New PrinterSetup
ps.SetupString = Settings

ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300


g = OpenPrinter(ps) <<<< Crash Way

If g <> Nil then
if rpt.Run(DataReports,ps) then //if the report ran successfully, print it
rpt.Document.Print(g)
end if
end if

Author:  timhare [ Sun May 19, 2013 3:27 pm ]
Post subject:  Re: Printing Way this no works

It is not possible to create a printersetup entirely in code. You have to show the setup dialog at least once. You can capture the setupstring from the dialog an save it for later use, but you can't create it outside the setup dialog.

Author:  jetpr [ Mon May 20, 2013 4:05 pm ]
Post subject:  Re: Printing Way this no works

thanks for the help but i found how to made it works

Dim tmpSetupString as MemoryBlock

Settings ="DoNotAlterThis=SetupString.2"_
+EndOfLine+"ActualHorizontalResolution=203"_
+EndOfLine+"ActualVerticalResolution=203"_
+EndOfLine+"MaxHorizontalResolution=300"_
+EndOfLine+"MaxVerticalResolution=300"_
+EndOfLine+"MarginLeft=0"_
+EndOfLine+"MarginRight=14376"_
+EndOfLine+"MarginTop=0"_
+EndOfLine+"MarginBottom=0"_
+EndOfLine+"MinMarginLeft=0"_
+EndOfLine+"MinMarginRight=14376"_
+EndOfLine+"MinMarginTop=0"_
+EndOfLine+"MinMarginBottom=0"_
+EndOfLine+"PageSetupFlags=6"_
+EndOfLine+"DevModeStructureSizePS=1044"_
+EndOfLine+"DevModeStructurePS=Star TSP100 Tear Bar (TSP113)"


tmpSetupString=new MemoryBlock(lenb(Settings)) <<<<<<<<<<<<<
ps.SetupString = tmpSetupString

''if ps.PageSetupDialog then
ps.MaxHorizontalResolution = 300
ps.MaxVerticalResolution = 300
''
'If ps.PageSetupDialog Then 'necessary to update the PageSetup object to 300 DPI
'Dug=ps.SetupString
'g = OpenPrinterDialog(ps, Nil)
'Dug=ps.SetupString
'End

g = OpenPrinter(ps)

If g <> Nil then
if rpt.Run(DataReports,ps) then //if the report ran successfully, print it
rpt.Document.Print(g)
end if
end if

Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/