Print more Excel documents to PDF files from MS Excel VBA application

why does it install 2 printers (docPrint and docPrint PDF Driver) ??? this is very complicated for the user then to select the right one ...

o.k. thx again

now i see TWO printers: docprint and docprint pdf printer driver ... is this right ? i am not sure if i have installed a trial before and didnt deinstall this ...
=========================
Yes, this is right, docPrint Pro v5.0 is contain two printers, docPrint and docPrint PDF Driver.

docPrint is useful for document printing preview function,

docPrint PDF Driver is useful to create PDF, PS, EPS, TIFF, JPG, etc. formats.

If you needn't docPrint, you can run following application to delete it,

"C:\Program Files\docPrint Pro v5.0\unpdf.exe"

VeryPDF
=========================
i've installed now docprint sdk ...
some questions:

- how can i specify "OVERWRITE EXISTING FILE" when print to file(s) ?
- how can i specify to ignore paper size for JPG file - this means not to print on A4 or something like that and to generade the file only with the image within and not to get "white bars around the image" ?
- it put a string for the filename example
"Y:\...\...\etikett_1.jpg" and the driver generates then a file
"y:\...\...\etikett_1_0001.jpg" --> i do not want this ...
- it works per default with JPG fine, how to switch for ex. to EMF ?
=========================
docPrint SDK does overwrite existing PDF file automatically, you needn't specify any additional parameters for overwriting.

Do you wish remove margins from output image files? If yes, you can use trimimage.exe to crop the margins, for example,

"C:\Program Files\docPrint Pro v5.0\psdriver\trimimage.exe" C:\in.tif C:\out.tif

"C:\Program Files\docPrint Pro v5.0\psdriver\trimimage.exe" C:\in.bmp C:\out.png

"C:\Program Files\docPrint Pro v5.0\psdriver\trimimage.exe" C:\in.jpg C:\out.png

Do you want stop add the page header and footer to printout image files? If yes, you need clear the page header and footer options from printing application, such as MS IE or Word or other printing application.

If you wish create the EMF files, you need use docPrint Printer to instead of docPrint PDF Driver, docPrint PDF Driver does support PDF, PS, EPS, JPG, PNG, etc. files creation, but it can't create EMF and WMF files, if you wish create EMF and WMF files, you need use docPrint printer.

You can simple use "-e" parameter to use the docPrint printer, please refer to following command line,

"C:\Program Files\docPrint Pro v5.0\doc2pdf.exe" -e -i C:\input.doc -o C:\output.emf

VeryPDF
=========================
i have found a solution for ONE of my problems;

in windows printer server properties i generated one custom formular with 15x10cm and a indiv. name ...
selecting this paper as the standard one for the doc driver ... printing

pls see the sample out file ... looks better, i can play with adjusting the size to fulfill my req. ...

i hope you will find solutions for the other problems ...
=========================
Thanks for your message, in order to solve the "concurrent printing" problem, you can install several docPrint PDF Driver printers, for example, you can use administrator privilege to run following .bat file to add 20 PDF Drivers into your system, then you can convert up to 20 documents to PDF files at same time,

"C:\Program Files\docPrint Pro v5.0\psdriver\batchaddprinters.bat"

You can install 30, 50, 100 or more PDF Printers into your system for the concurrent printing service.

If this solution is okay to you, please feel free to let us know, we will provide a DLL function to you to find out which printer is "idle" and where to set output filename, if so, you can set output filename for idle printer easily.

VeryPDF
=========================
thank you for your response.
i think it is not a good idea to generate so much printers because it's running on a terminalserver 😉 ... and i think printers can't be hidden ...

why does the driver read the information from registry at the time printing of doc starts and not when the job is scheduled ????

i have this open points now:

- read from registry to late in printing process
- filenames for example "etik_1.jpg" are renamed to "etik_1_0001.jpg" from the driver
- automatic marginless and automatic papersize depending on the resulting size of the image

it wouldt be great if we can find a solution.

one more question which does not depend on your software:
if i start printing job within the loop 300 times, windows does pop up the windows-printing-progress-dialog which is confusing the user ... do you know how to disable this in windows within the makro?

=========================
Because printing speed is slow, the Windows Printing System is can only printing one document at one time, you are unable to print more documents to same printer at same time, this is a design in Windows Spool System.

So, in our docPrint PDF Driver product, if you use just one printer, you can only print one document to docPrint PDF Driver at one time, you need put all documents to a queue, and print these documents to docPrint PDF Driver one by one.

However, we have following solutions to you,

Solution 1:
We have a DOC to Any Converter product, if you can save the selected Excel cells to a temp Excel file first, you can call DOC to Any Converter to convert this Excel document to PDF file, DOC to Any Converter does accept the options from command line, it does not store the output filename to registry, so it does support concurrent conversion properly,

http://www.verydoc.com/doc-to-any.html

you can run following command line to batch convert more documents to PDF files or image files at same time,

start "" "%CD%\doc2any.exe" -killoffice 0 -useprinter "%CD%\example.docx" "%CD%\example.docx.pdf"
start "" "%CD%\doc2any.exe" -killoffice 0 -useprinter "%CD%\example.doc" "%CD%\example.doc.pdf"
start "" "%CD%\doc2any.exe" -multipagetif -bitcount 1 -xres 300 -yres 300 -killoffice 0 -useprinter "%CD%\example.docx" "%CD%\example.docx.tif"
start "" "%CD%\doc2any.exe" -multipagetif -bitcount 1 -xres 300 -yres 300 -killoffice 0 -useprinter "%CD%\example.doc" "%CD%\example.doc.tif"

if you think DOC to Any Converter product is reach your requirement, we can exchange your docPrint SDK with DOC to Any Converter product to you free.

=========================
Solution 2:
Also, we have another solution to you, we can assist you to install a Postscript Printer Driver into your system, you can use "PrintToFile" option to print your selected Excel Cell to a Postscript file first,

Sub Print_PDF()
Application.ActivePrinter = "VeryPDF Postscript Printer"
Worksheets(Array("MRA2", "HMA")).Select
ActiveWindow.SelectedSheets.PrintOut , , , , , printtofile = True, , prtofilename = "c:\test.ps"
End Sub

After you get "c:\test.ps" file, we will provide a Command Line application to you to convert Postscript file to PDF or image file again, this solution does support concurrent printing too.
=========================

Solution 3:
If you are using Office 2007 or 2010, you can install "Microsoft Office 2007 Add-in: Microsoft Save as PDF or XPS" first, then you can save Excel to PDF file by following sample code,

-------------------------------------------------------
Const xlTypePDF = 0

if  Wscript.Arguments.Count > 0 Then

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objExcel = CreateObject("Excel.Application")

For i = 0 to wscript.arguments.count - 1
Set objFile = objFSO.GetFile(WScript.Arguments(i))
Set objDoc = objExcel.Workbooks.Open(WScript.Arguments(i),,TRUE)
dirPath = objFSO.GetParentFolderName(objFile)
fileBaseName = objFSO.GetBaseName(objFile)

pdf = objExcel.ActiveWorkbook.ExportAsFixedFormat (xlTypePDF,dirPath & "\" & fileBaseName & ".pdf")
objExcel.ActiveWorkbook.Close(False)
Next

objExcel.Quit
Else
msgbox("Sie muessen eine Datei zum konvertieren ausw?hlen.")
End If
-------------------------------------------------------

You can use "ExportAsFixedFormat" function to convert Excel document to PDF file directly, this solution does support concurrent conversion function too.

If you wish convert PDF file to image files, we can provide a PDF to Image Converter Command Line to you free, you can call PDF to Image Converter Command Line from your code to convert PDF file to image file again.
======================================

Above three solutions are all can solve "concurrent printing" function to you, what is your attitude for above three solutions?

From my point, solution #3 is great, you can try the solution #3, save the Excel document to PDF file first, and convert PDF file to image files at later.

Because JPG format doesn't support multi-page format, so we have to append "XXXX" number to the filename. If you wish disable this feature, please feel free to let us know, we will add an option to you to disable this feature.

You can simple call following command line from your code to remove the margins from image files, we hoping this command line application will useful to you,

"C:\Program Files\docPrint Pro v5.0\psdriver\trimimage.exe" C:\in.png C:\out.png

MS Office application hasn't an option to hide the printing dialog, in the past, we have developed a "HideDialogs.exe" application, this HideDialogs.exe does lookup all windows and hide the printing dialog automatically, if possible, you write this application too, for example,

HWND hWnd = FindWindow("Title of excel printing dialog");
ShowWindow(hWnd, SW_HIDE);

We hoping above solution will helpful to you, you may give it a try.

VeryPDF
=========================
today evening i will try to save in the loop with sheet.saveas directly to a xls file ...
if this works fast and well then we can try it with your solution to convert all the 300 file AFTER the loop with a cmd/batch to generate the jpg files ...
will the jpg files then have the same quality as if gong throug the printer driver ??? because that is what i ned ...
or then maybe directly to EMF files ?

=========================

Yes, PDF to Image Converter does create the JPG files have same quality as if gong through the printer driver.

Also, PDF to Image Converter is able to convert PDF files to raster EMF files, all contents will be converted into an entire image in the EMF file.

VeryPDF

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!