Hi, Support:
I want to print any pdf file with custom paper size,but it throws exception, therefore , all the print jobs fail. my code is as follow:
Dim printersetting As System.Drawing.Printing.PrinterSettings = New System.Drawing.Printing.PrinterSettings()
printersetting.Copies = Copies 'Copies=1
printersetting.PrinterName = PrinterName 'PrinterName=“HP1106”
Dim pagesetting As System.Drawing.Printing.PageSettings = New System.Drawing.Printing.PageSettings(printersetting)
Dim viewer As PdfViewer = New PdfViewer()
viewer.BindPdf(InputPdf)
viewer.AutoResize = True
viewer.AutoRotate = True
pagesetting.PaperSize.Height = PrintHeight
'PrintHeight=428, the code throws an exception saying “pagesetting.PaperSize.Height is readonly except for the pagesetting.PaperSize.Kind = PaperKind.Custom”, however, when setting pagesetting.PaperSize.Kind = PaperKind.Custom, it throws an exception saying “pagesetting.PaperSize.Kind is readonly”
pagesetting.PaperSize.Width = PrintWidth 'PrintWidth=284
viewer.PrintDocumentWithSettings(pagesetting, printersetting)
How to print pdf file with custom paper size?
Thanks for your help!