Skip to main content
Participant
August 2, 2007
Question

VB.Net Printing of PDFs

  • August 2, 2007
  • 20 replies
  • 40748 views
I am trying to print a pdf document to a specific printer from VB.Net app. I would like this to be a silent process i.e. no print dialog and no Acrobat Reader popping up.

This solution must only use reader as it needs to work without licensing issues.

Anyone got any ideas?

I have managed to do it using the command line options but a reader window pops up and wont go away.
This topic has been closed for replies.

20 replies

Participant
July 19, 2012

i wrote an article how to open and show and silent print pdfs in Windows and Mac OSX with examples (using native commands):
http://www.onyrix.com/2012/04/adobe-air-pdf-silent-print-with-acrobat-reader/

bye
d

even if is for Adobe Air you can you native commands examples for any other programming language

Participant
November 29, 2008
Change the sentences
VB.NET
Arguments = "/t """ & Filename & """"
by
C#
Arguments = "/t " + path_file + " " + path_printer + ""
Participant
October 21, 2008
test
Participant
July 22, 2008
You can change this to C code or what ever your preference is. You will need to have the Ghostscript loaded with the PDFCreator program.
Participant
July 22, 2008
download the PDFCreator from Sourceforge - http://sourceforge.net/projects/pdfcreator/

Set it as the default printer (can do this in the code if you want)
Set the settings in the PDFCreator Printer options in the Auto-save section to not have pop-ups and where to save the document.

If you want to get fancy, you can call the word, excel, or whatever with a minimized window to get NO windows popping up.

Let it fly:

Imports System
Imports System.Diagnostics
Imports System.IO

Module Module1
Const pdfTempFolder As String = "c:\tempPDF"
Const pdfResultsFolder As String = "c:\tempPDF\"
Dim DocumentName As String
' ------------------------------------------------------------
Dim di As New IO.DirectoryInfo("c:\tempPDF")
Dim aryFi As IO.FileInfo() = di.GetFiles("*.doc")
Dim fi As IO.FileInfo

Sub Main()
For Each fi In aryFi
Console.WriteLine("File Full Name: {0}", fi.FullName)
DocumentName = fi.FullName
Print(DocumentName)
Next
End Sub

Sub Print(ByVal DocumentName)
Dim proc As New Process
Console.WriteLine("DocumentName Sent to Process Start is: " + DocumentName)
proc.StartInfo.FileName = DocumentName
proc.StartInfo.Verb = "Print"
proc.StartInfo.CreateNoWindow = True
proc.Start()
End Sub
End Module
Participant
July 8, 2008
Thank you very much Saradhi Cheruvu... The code worked for me too by increasing the sleep time to 30 seconds...
Patrick_Leckey
Participating Frequently
June 26, 2008
No, based on your more complete description of your workflow you should be within the bounds of the EULA so no problem there.

Your best bet, since you have a full version of Acrobat, would be to create a silent print plug-in in C/C++ and then call that plug-in from your VB application. That way you can assure it is a silent, dialog-less print (and quite frankly, a simple silent print plug-in that doesn't require any advanced configuration options will not take long to build at all for an experienced developer).
Participant
June 26, 2008
And by request I mean someone physically tells me they need some hardcopies sent somewhere and I select the files to print and push a button to batch print them.

I apologize if the language I used out of habit is confusing.
Participant
June 26, 2008
Sorry it is not run on a server. It is a stand-alone application that we call a server because it handles document management requests that are outside of adobe(ie our file structure) as well as has a lot of utilities for managing our database and files. I create the batch print jobs and manually submit them. These are by request though if that matters and if so since everyone has Adobe installed already would it be fine if we just had them run a striped down version to print? This still brings it back to the issue that adobe pops up and interrupts your workflow for anyone that prints. This is completely unacceptable for programming adobe into an end user application.

Either way if we misread what means to be a stand alone application and not I apologize. We will gladly switch to an alternative since this is small piece of it.
Patrick_Leckey
Participating Frequently
June 26, 2008
> I run a server program for our business which does batch printing via ole automation

Well, there's your problem. Acrobat is not designed for server use, and it's actually expressly forbid in the EULA (Section 2.3, Server Use). Using it in a server-based automation fashion is a violation of the EULA, and since you've just publicly posted on Adobe forums that you're using it in that way it would probably be a good idea to remove it from your server before you get a call from Adobe Legal (believe me, they do follow-up on license violations).

The OLE automation is designed to automate desktop installs of Acrobat. It is, per the EULA and documentation, required that each end-user have a licensed copy of Acrobat on their machine and that the automation software be installed locally on their machine as well. There can be no situation where multiple users are submitting requests to a single copy of Acrobat in an automated fashion.

The reason its not working the way you expect it to is because it was expressly designed NOT to work in a server environment. That's what the LiveCycle products are for. Using Acrobat as part of any server-based workflow is illegal, so Adobe certainly don't develop it to be server-friendly.