How to print a PDF file Using VB

来源:互联网 发布:指南针软件使用教程 编辑:程序博客网 时间:2024/06/05 16:15

Instructions

    • 1

      Create a new project in Visual Basic by clicking on "File" and "New project." Select "Console Application." Alternatively, you can just add the code from the rest of the tutorial anywhere you like within an existing project.

    • 2

      Paste the following code within Visual Basic to call the PDF print script:

      dim filename = "C:\pdfFileToPrint.PDF"

      Process.Start("printPDF.vbs " & filename)

    • 3

      Click on "Project" and "Add new item." Select "Text File" and name it "printPDF.vbs."

    • 4

      Paste the following code within it:

      Set fso = CreateObject("Scripting.FileSystemObject")

      fullPath = fso.GetAbsolutePathName(WScript.Arguments(0))

      WScript.CreateObject ("Shell.Application").Namespace(0).ParseName( fullPath ).InvokeVerb "&Print"

    • 5

      Save your work.


Read more: How to Print a PDF File Using VB | eHow.com http://www.ehow.com/how_7302312_print-pdf-file-using-vb.html#ixzz2G2hAL6ii
原创粉丝点击