[RESOLVED] Printing PDF Files
Hi everyone,
I am using the adobe pdf control in my app to load a pdf file and I call the PrintAll method to print it. I then tried to loop through pdf files by loading and printing each. But it only prints one. It seems not to runi n synchronous mode. It done one and then is done because it did nto have time to load and print the others? Not sure.
Does anyone know how to print multiple pdf files? I've already tried many codes I saw for calling the pdf with shellexecute and other ways but it does not work. Many of the pdf controls out there are a lot of money! Any suggestions?
Thanks
Warren
Re: [RESOLVED] Printing PDF Files
It did work but now have an issue with it. I get the Adobe Reader X screen popup at times and when I close it, the print continues.
I did modify the code to use the files from a listbox. The files are listed without the extensions so you can see where I added the .pdf.
Code:
For X = 0 To ListBox2.Items.Count - 1
Dim V1 As String = ListBox2.Items(X).ToString & ".pdf"
lblFile.Text = V1
Dim strPDFFile As String = Dir("c:\pdffiles\*" & V1)
Dim PrintPDFFile As New ProcessStartInfo
Do Until strPDFFile Is Nothing
PrintPDFFile.UseShellExecute = True
PrintPDFFile.Verb = "print"
PrintPDFFile.WindowStyle = ProcessWindowStyle.Hidden
PrintPDFFile.FileName = "c:\pdffiles\" & strPDFFile
Process.Start(PrintPDFFile)
If btnYes.Checked = True Then
Dim A1 As String = ListBox2.Items(X).ToString
If File.Exists(WLPath) = True Then
Process.Start(WLPath, A1)
End If
End If
strPDFFile = Dir()
Loop
Next
Re: [RESOLVED] Printing PDF Files
Does anyone know how to use this code and not have the Adobe Reader X screen show at times?
Thanks
Re: [RESOLVED] Printing PDF Files
I ditched Adobe Reader years ago to print PDF's & now use PDF-Xchange. Much simpler & more reliable in my experience.
Re: [RESOLVED] Printing PDF Files
Thanks for the reply on that product. I just went to their webpage and it looks like a stand alone program. I want to print from within my .net app. I would even use this if I can call it passing the pdf but not see the program at all.
Can this do anything like that?
Thanks,
Warren
Re: [RESOLVED] Printing PDF Files
You can print from PDF-XChange viewer by passing command line arguments.
From the manual:
1.8. Command Line option
The PDF-XChange Viewer may be started with a PDF file or URL name as the first item on the command line. This facilitates starting the
Viewer in File Associations or using Windows ShellExecute.
The form of the command line for using this option is:
PDFXCview.exe [command] [filename1] [[filename2] [… [filenameN]]]
Where command can be one of the following commands:
/A "param=value [¶m2=value [&...]"
/close[:save|discard|ask]
/print[:[default=yes|no][&showui=yes|no][&printer=<printername>][&pages=<pagesrange>]]
/printto[:[default=yes|no][&showui=yes|no][&pages=<pagesrange>]] <printername>
/exportp <setting_file_name>
/importp <setting_file_name>
/RegServer
/UnregServer
/usep <setting_file_name>
Re: [RESOLVED] Printing PDF Files
Hi,
I finally downloaded and installed the viewer. Now I am trying to call the viewer with the command line like you show. When i type the following, it says windows cannot find c:\Program. How would I type this to be called? And do I add the /close parameter to now show the program window? Thanks for any help you can give!
C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe /print c:\bottle1.pdf
Re: [RESOLVED] Printing PDF Files
I did this in DOS while in the folder and it worked. I added the showui=no so that worked great too.
I was typing in the C:\Program Files\Tracker Software\PDF Viewer\PDFXCview.exe /print c:\bottle1.pdf in the windows Run window. I'll try this in VB.NET now.
Thanks
Re: [RESOLVED] Printing PDF Files
This is taken directly from one of my programs:
Code:
Process.Start("C:\Program Files\Tracker Software\PDF Viewer\pdfxcview.exe", " /print:printer=""" & printerName & """ """ & pdfFile & """")
You just need to provide the printer name & pdf filename. If you dont provide a printer name I think it will just print to the default printer.
Re: [RESOLVED] Printing PDF Files
Thanks for the example. That was exactly what I needed!
Warren
Printing PDF Files with PDF X-Change
Hi,
Everything works fine, except... My PDF file is in landscape format and print out of the printer in Portrait format... Any way I can provide the page orientation in the command line? I can't find any info on the available parameters...
[QUOTE=nbrege;4084109]This is taken directly from one of my programs:
Code:
Process.Start("C:\Program Files\Tracker Software\PDF Viewer\pdfxcview.exe", " /print:printer=""" & printerName & """ """ & pdfFile & """")