Hi,
I am currently evaluating the Aspose.Pdf.Kit for .NET and I am having problems with the copies when trying to print programmatically using the PrinterSettings.
The problem is that, when I try to set the Copies property to a number greater than 1, the actual printed copies are multiplied by the number I provided. Like when I set the copies to 2, the actual copies printed is 4. When I set it to 3, the copies printed is 9.
Am I missing something in the settings or this is a bug?
Here's the code:
viewer.OpenPdfFile(_pdfFilePath)
'set attributes for printing
viewer.AutoResize = True 'print the file with adjusted size
viewer.AutoRotate = True 'print the file with adjusted rotation
viewer.PrintPageDialog = False 'do not produce the page number dialog when printing
'create objects for printer and page settings and PrintDocument
Dim ps As New PrinterSettings()
Dim pgs As New System.Drawing.Printing.PageSettings()
'set printer name
ps.PrinterName = "Some printer name"
'set the color
ps.Copies = 2
ps.Collate = PrintArgs.PrintCollate
ps.PrintRange = PrintRange.AllPages
'Set Page Size
For i As Integer = 0 To ps.PaperSizes.Count - 1
If ps.PaperSizes(i).RawKind = PrintArgs.PrintPageSize Then
pgs.PaperSize = ps.PaperSizes(i)
Exit For
End If
Next
'Set Paper Tray
For i As Integer = 0 To ps.PaperSources.Count - 1
If ps.PaperSources(i).RawKind = PrintArgs.PrintPaperTray Then
pgs.PaperSource = ps.PaperSources(i)
Exit For
End If
Next
'set PageMargins (if required)
pgs.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)
'print document using printer and page settings
viewer.PrintDocumentWithSettings(pgs, ps)
'close the PDF file after priting
viewer.ClosePdfFile()
Thanks.
I am currently evaluating the Aspose.Pdf.Kit for .NET and I am having problems with the copies when trying to print programmatically using the PrinterSettings.
The problem is that, when I try to set the Copies property to a number greater than 1, the actual printed copies are multiplied by the number I provided. Like when I set the copies to 2, the actual copies printed is 4. When I set it to 3, the copies printed is 9.
Am I missing something in the settings or this is a bug?
Here's the code:
viewer.OpenPdfFile(_pdfFilePath)
'set attributes for printing
viewer.AutoResize = True 'print the file with adjusted size
viewer.AutoRotate = True 'print the file with adjusted rotation
viewer.PrintPageDialog = False 'do not produce the page number dialog when printing
'create objects for printer and page settings and PrintDocument
Dim ps As New PrinterSettings()
Dim pgs As New System.Drawing.Printing.PageSettings()
'set printer name
ps.PrinterName = "Some printer name"
'set the color
ps.Copies = 2
ps.Collate = PrintArgs.PrintCollate
ps.PrintRange = PrintRange.AllPages
'Set Page Size
For i As Integer = 0 To ps.PaperSizes.Count - 1
If ps.PaperSizes(i).RawKind = PrintArgs.PrintPageSize Then
pgs.PaperSize = ps.PaperSizes(i)
Exit For
End If
Next
'Set Paper Tray
For i As Integer = 0 To ps.PaperSources.Count - 1
If ps.PaperSources(i).RawKind = PrintArgs.PrintPaperTray Then
pgs.PaperSource = ps.PaperSources(i)
Exit For
End If
Next
'set PageMargins (if required)
pgs.Margins = New System.Drawing.Printing.Margins(0, 0, 0, 0)
'print document using printer and page settings
viewer.PrintDocumentWithSettings(pgs, ps)
'close the PDF file after priting
viewer.ClosePdfFile()
Thanks.