Printing to a pdf printer programmatically

前端 未结 11 1181
慢半拍i
慢半拍i 2021-01-06 15:40

I am trying to print an existing file to PDF programmatically in Visual Basic 2008.

Our current relevant assets are: Visual Studio 2008 Professional Adobe Acrobat Pr

11条回答
  •  迷失自我
    2021-01-06 16:18

    Similar to other answers, but much simpler. I finally got it down to 4 lines of code, no external libraries (although you must have Adobe Acrobat installed and configured as Default for PDF).

        Dim psi As New ProcessStartInfo
        psi.FileName = "C:\Users\User\file_to_print.pdf"
        psi.Verb = "print"
        Process.Start(psi)
    

    This will open the file, print it with default settings and then close.

    Adapted from this C# answer

提交回复
热议问题