【问题标题】:Select Printer to Print PDF file in vb.net在 vb.net 中选择打印机以打印 PDF 文件
【发布时间】:2017-11-26 18:31:38
【问题描述】:

我必须选择一台打印机并打印一个 PDF 文件。 我在这里使用,此代码仅在默认打印机中打印.. 我厌倦了搜索,但没有找到解决方案。

    Dim PrintPDF As New ProcessStartInfo
    PrintPDF.UseShellExecute = True
    PrintPDF.Verb = "print"
    PrintPDF.WindowStyle = ProcessWindowStyle.Hidden
    PrintPDF.FileName = "temp.pdf" 'fileName is a string parameter
    Process.Start(PrintPDF)

我已经完成了另一部分来在下拉列表中查找打印机 此代码用于查找打印机

Dim pkInstalledPrinters As String
For Each pkInstalledPrinters In PrinterSettings.InstalledPrinters
ComboBox1.Items.Add(pkInstalledPrinters)
Next pkInstalledPrinters     
ComboBox1.SelectedIndex = ComboBox1.Items.Count - 1

有什么建议吗? 谢谢。

【问题讨论】:

    标签: vb.net pdf printing


    【解决方案1】:

    试试这个,

    我在表单中添加了一个 Web 浏览器控件。 添加您的pdf文件名的文件名如下:

    WebBrowser1.naviagte(YourFileName)

    试试 WebBrowser1.Print() 抓住前任作为例外 消息框(例如消息) 结束尝试

    执行此操作时,您的应用会显示带有内置选项的打印对话框,您需要使用哪台打印机进行打印。

    【讨论】:

    • ''MissSpell: WebBrowser1.navigate(YourFileName)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-07-31
    • 2019-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-02-22
    • 2014-08-25
    相关资源
    最近更新 更多