You can print a page without using the print dialog.
Use such script for printing:
Public Sub PrintPageSilent(ByVal fredApp As IFredApp, ByVal ConfigName As String, ByVal StrCaption As String, ByVal extFile As String)
Dim opt As PrintOptions = fredApp.GetPDFOptions("")
If Not opt Is Nothing Then
opt.Load(EditorialLogin.Get(), ConfigName)
If Page.TestTwoSides Then ' double page
opt.DoublePrint = Side.Left.ToString()
opt.PDFFile = BuildOutFileName() & "." & extFile
StatusArea.ProgressBar(1, 2, "Printing left side...")
fredApp.PDFGenerate(opt)
StatusArea.ProgressBar(0, 0, Nothing)
opt.DoublePrint = Side.Right.ToString()
opt.PDFFile = BuildOutFileName() & "." & extFile
StatusArea.ProgressBar(1, 2, "Printing right side...")
fredApp.PDFGenerate(opt)
StatusArea.ProgressBar(0, 0, Nothing)
Else
opt.DoublePrint = Side.Single
opt.PrintQueueName = "PS File"
opt.PDFFile = BuildOutFileName() & "." & extFile
StatusArea.ProgressBar(1, 2, "Printing page...")
fredApp.PDFGenerate(opt)
StatusArea.ProgressBar(0, 0, Nothing)
End If
End If
End Sub
Public Function BuildOutFileName()
Dim EDDate As String
Dim EDDay As String
Dim EDMonth As String
Dim EDYear As String
Dim edition As Schema.Class.editionObj = Page.GetPageEdition
EDDate = edition.dateAttr.ToLocalTime()
EDDate = Replace(EDDate, "/", "")
EDDay = Left(EDDate, 2)
EDMonth = Mid(EDDate, 3, 2)
EDYear = Mid(EDDate, 5, 4)
Dim NumberOrd As String = UtilsBase.GetObjAttrValue(Page.GetPageEditionId, "NumberOrd")
If Not IsNumeric(NumberOrd) Then NumberOrd = "0"
Dim PageNum As String = Page.GetPageNumber
Dim NameFilePdf As String = ""
NameFilePdf = EDYear & "_" & EDMonth & "_" & EDDay & "_" & Right("000" & NumberOrd, 3) & "_" & Right("000" & PageNum, 3)
Return NameFilePdf
End Function
Execute it as:
PrintPageSilent(Fred, "PS_Web", "", "ps")