PdfViewer

Hello,


Is there way to pass the printer name ip address to print rather than setting to default printer?

<span style=“background-color: rgb(255, 255, 255); color: rgb(51, 51, 51); font-family: “Courier New”, Courier, monospace; font-size: 12.0333px;”>'create AcroPDF object
<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>Dim pdf As New AcroPDFLib.AcroPDF()
'set source PDF file
pdf.src = “c:\input.pdf”
'print all pages
pdf.printAll()<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>
<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”> It is label printing in PDF format that needs to be sent an IP printer rather than <pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>local default printer. <pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>
<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”> Please let me know if it is possible to pass parameters or properties.<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>
<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>Thank You,<pre class=“code-java” data-trid=“691” style=“padding: 0px; margin-top: 0px; margin-bottom: 0px; overflow: auto; font-family: “Courier New”, Courier, monospace; line-height: 1.3; color: rgb(51, 51, 51); font-size: 12.0333px; background-color: rgb(255, 255, 255);”>Senthil

Hello Senthil,


Thanks for using our API’s.

Please see following example, it will help you to explore more features of PdfViewer Class. You can use PrintDocumentWithSettings method of PdfViewer class to set the Printer name.
Dim dataDir As String = "C:/"
' Create PdfViewer object
Dim viewer As New PdfViewer()
' Open input PDF file
viewer.BindPdf(dataDir & Convert.ToString("input1.pdf"))
' 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()
' Set XPS/PDF printer name
ps.PrinterName = "Microsoft XPS Document Writer"
' Or set the PDF printer
' Ps.PrinterName = "Adobe PDF";
' 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()

If you still face any issue, please feel free to contact us.

Best Regards,

Thank you for reply!


I am looking for ways to print binary files to IP printer. The file type may be .pdf or .bin.

Please let me know how it can be configured to work for .BIN format.

Thank You,
Senthil

Please look at the sample file.

Hi Senthil,

Thanks for your inquiry.

Adobe Acrobat Automation allows you to perform various tasks on PDF files in your code. Aspose.Pdf for .NET also provides the functionality to perform PDF manipulation programmatically. The PdfViewer class in Aspose.Pdf for .NET allows you to print only PDF file. If you want to print other format files, you can first convert them to PDF format for printing.

If you need further assistance, please feel free to contact us.

Best Regards,