While creating a Viewer object in code to load and print a PDF document, the .Print command will print the document, but not resize. The .PrintFit will not do anything and it will return a status of OK. While stepping through, it doesn't even take any time with the command. The .PrintFitDialog command works as expected, but I lose control over the presentation of the dialog. Any help will be appreciated.
Code: Select all
Dim oViewer As GdViewer = Nothing
Dim oPrintDialog As PrintDialog = Nothing
Dim blPrint as boolean = false
Dim oFile as io.fileinfo = new io.fileinfo(Pdf_file)
Try
oPrintDialog = New PrintDialog
oPrintDialog.AllowPrintToFile = False
oPrintDialog.AllowCurrentPage = True
oPrintDialog.AllowSelection = False
oPrintDialog.AllowSomePages = True
oPrintDialog.PrinterSettings.MaximumPage = 100
oPrintDialog.PrinterSettings.FromPage = 1
oPrintDialog.PrinterSettings.ToPage = 100
If oPrintDialog.ShowDialog = Windows.Forms.DialogResult.OK Then
blPrint = True
End If
If blPrint = true Then
oViewer = New GdViewer
oViewer.SetLicenseNumber(sPictureLic)
oViewer.DisplayFromFile(oFile.FullName)
oViewer.PrintSetActivePrinter(oPrintDialog.PrinterSettings.PrinterName)
oViewer.PrintSetFromToPage(oPrintDialog.PrinterSettings.FromPage, oPrintDialog.PrinterSettings.ToPage)
oViewer.PrintSetCopies(oPrintDialog.PrinterSettings.Copies)
oViewer.PrintSetDocumentName("This is my name")
oViewer.Print '// Prints but does not resize
oViewer.PrintFit() '// Will not do anything - gdstatus = 0
oViewer.CloseDocument()
oViewer = Nothing
else
oViewer = New GdViewer
oViewer.SetLicenseNumber(sPictureLic)
oViewer.DisplayFromFile(oFile.FullName)
oViewer.PrintFitDialog(me) '// Works, but lose some control
oViewer.CloseDocument()
oViewer = Nothing
End If
Catch ex As Exception
End Try