Hello all,
Okay so the problem we are coming across is the ability to print from a web server to a network printer that is connected to the server.
When I run this on my local machine in my development environment it works okay but when on the live server I am having troubles.
Can anyone help me out? or what I should be setting as the Printer Name, Location.
Or is it even possible?
Thanks in advance
The code is very simple and based on examples
'create PdfViewer object
Dim viewer As New PdfViewer()
'open input PDF file
viewer.BindPdf(Server.MapPath(txtFileLocation.Text))
'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 System.Drawing.Printing.PrinterSettings()
Dim pgs As New System.Drawing.Printing.PageSettings()
Dim prtdoc As New System.Drawing.Printing.PrintDocument()
'set printer name
ps.PrinterName = txtPrinterName.Text
'set PageSize (if required)
pgs.PaperSize = New System.Drawing.Printing.PaperSize("A4", 827, 1169)
'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.Close()'create PdfViewer object
Dim viewer As New PdfViewer()
'open input PDF file
viewer.BindPdf(Server.MapPath(txtFileLocation.Text))
'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 System.Drawing.Printing.PrinterSettings()
Dim pgs As New System.Drawing.Printing.PageSettings()
Dim prtdoc As New System.Drawing.Printing.PrintDocument()
'set printer name
ps.PrinterName = txtPrinterName.Text
'set PageSize (if required)
pgs.PaperSize = New System.Drawing.Printing.PaperSize("A4", 827, 1169)
'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.Close()