M 
		
				
			
		MasterPanda
Guest
I have used the below .NET ABL code to print the pdf using the default printer option. Now I want to set those Printer and Page settings. I know they are in System.Drawing.Printing setting, but anyone knows how to integrate this with the ProcessStartInfo to print it with those parameter settings.
	
	
	
		
Any help will be highly appreciable. Regards
Continue reading...
				
			
		Code:
	
	USING System.*.
USING System.Collections.Generic.*.
USING System.Diagnostics.*.
USING System.IO.*.
USING System.Linq.*.
USING System.Text.*.
USING System.Threading.Tasks.*.
USING System.Drawing.*.
DEFINE VARIABLE proc AS System.Diagnostics.Process   NO-UNDO.
DEFINE VARIABLE startInfo AS System.Diagnostics.ProcessStartInfo   NO-UNDO.
DEFINE VARIABLE printerSettings AS System.Drawing.Printing.PrinterSettings   NO-UNDO.
DEFINE VARIABLE pageSettings AS System.Drawing.Printing.PageSettings   NO-UNDO.
DEFINE VARIABLE sFileName  AS CHARACTER   NO-UNDO.
DEFINE VARIABLE sPrinter  AS CHARACTER   NO-UNDO.
DEFINE VARIABLE sArgs AS CHARACTER   NO-UNDO.
/* HOW To Handle Printer and Page Settings here? 
ASSIGN
    printerSettings = NEW System.Drawing.Printing.PrinterSettings()
    printerSettings:PrinterName = "Microsoft Print to PDF (redirected 4)"
    printerSettings:Copies = 01.
    
ASSIGN
    pageSettings = new System.Drawing.Printing.PageSettings(printerSettings). 
*/
ASSIGN
    startInfo = new System.Diagnostics.ProcessStartInfo()
    sFileName = "C:\temp\file.pdf"
    startInfo:FileName = sFileName    
    sPrinter  = "Microsoft Print to PDF (redirected 4)"
    startInfo:Verb = "print"
    startInfo:Arguments=sPrinter.
ASSIGN    
    startInfo:WindowStyle = System.Diagnostics.ProcessWindowStyle:HIDDEN
    startInfo:CreateNoWindow = TRUE
    proc = System.Diagnostics.Process:Start(startInfo).
proc:WaitForExit(15000).
IF NOT proc:HasExited THEN DO:
    proc:Kill().
    proc:Dispose().
END.
	Any help will be highly appreciable. Regards
Continue reading...