Batch convert HTML files to PDF files, batch extract paper size from PDF files, and batch crop PDF files

Hi,
We are using VeryPDF tool licensed tool to convert our html file to PDF file. We are using Doc convertor as a windows service "VeryPDF DocConverter COM Service". In our code we are using html2pdf.exe command line and PDFOUTLib. Doc2PDFCommandLine to execute the command line which is formed in html2pdf command line. Once we fire the above command we immediately delete the source html file from the hard disc by checking whether destination PDF file created in hard disc and not checking size and all.

When we run it for 500 html file some time the PDF file gets created only with "Page Not Found" as a content and original content is missing We would like to know how the verypdf Doc2PDFCommandLine method and "VeryPDF DocConverter COM Service" works in the background. Is it creating PFD file first and then its takes some time(x amount of time) to put the actual content. In the mean time we are deleting the source file, so its created with "page not found" as content. Could you please confirm our assumption.

Here with I have attached my code snippet also.

PDFOUTLib.PdfCreatorClass pdf = new PdfCreatorClass();
string command;
command = "html2pdf" + @" " + "\"" + sourceFile + "\"" + @" " + "\"" + destinationFile +"\"";
command += @" " + "\"" + @"papertype=" + pdfPageSize + ",Overwrite=yes,AutomaticValue=" + automaticValue + ",PrintHTMLBackground=yes,htmlFooters=&d &t" + "\"";

pdf.Doc2PDFCommandLine(command);

'calling method for deleting the source file

Thanks & Regards,

Customer.

------------------------------------------

Your code is no problem, you should better convert all of your HTML files to PDF files one by one, you should not run several instances to convert more HTML files to PDF files at one time.

You can also run html2pdf.exe to convert HTML files to PDF files directly, html2pdf.exe can be used easier than DocConverter COM product.

Please by following solution to batch convert lots of HTML or DOC or other documents to PDF files at one time,

1. Please run doc2pdf_service.exe as a normal Windows application by following command line,

doc2pdf_service.exe -exe

2. Please run following command line to convert all of HTML files to PDF files in D:\test folder and sub folders,

for /r D:\test %F in (*.htm) do html2pdf.exe "%F" "%~dpnF.pdf" "Overwrite=yes,KillProcess=no,doc2pdf_service=yes"

you can replace "D:\test" folder to correct folder in your system.

All of your HTML files will be converted to PDF files at one time by above command line.
if you needn't convert HTML files in sub folders, you can run following command line to convert all HTML files in D:\test folder only,

for %F in (D:\test\*.htm) do html2pdf.exe "%F" "%~dpnF.pdf" "Overwrite=yes,KillProcess=no,doc2pdf_service=yes"

you can also call following command line from Windows Service or your web applications to convert DOC file to PDF file properly,

html2pdf.exe "C:\file.Doc" "C:\file.pdf" "Overwrite=yes,KillProcess=no,doc2pdf_service=yes"

VeryPDF

------------------------------------------

I need to retrieve the paper size from a PDF file, with no printing.
I am using the following command:

C:\pdfprint.exe -paper "pdf" "C:\2310.pdf"

All I get is pdfprint printing the file out to the default printer.

------------------------------------------

You can use Advanced PDF Tools Command Line product to extract paper size from PDF files, Advanced PDF Tools Command Line can be downloaded from following web page,

http://www.verypdf.com/app/advanced-pdf-tools/advanced-pdf-tools-command-line-guide.html

You can use -r parameter to extract paper size and other information from PDF file, for example,

pdftools.exe -r -i D:\test.pdf

VeryPDF

------------------------------------------

I have a folder of PDF files. Each page in each file is 11 x 14.5 inches. I need to crop the right .5 inch off of each page in each file in the input directory so that the resulting pages are all 11 x 14. What do I need to do this? How fast does it run?

------------------------------------------

You need convert from Inch to Point unit first,

11inch = 792pt
14inch = 1008pt

You can run following command line to crop one PDF file only,

pdftools -i "C:\input.pdf" -o "C:\output.pdf" -X "Crop:0 0 792 1008"

You can run following command line to crop all PDF files in D:\temp folder, you can change this folder to any folder that you want,

for %F in (D:\temp\*.pdf) do pdftools -i "%F" -o "C:\test\%~nF.pdf" -X "Crop:0 0 792 1008"

VeryPDF

------------------------------------------

What is the PDFPrint -paper "pdf" command for?

PDFPrint -paper "pdf"

Customer

------------------------------------------

image

PDFPrint -paper "pdf" will read the paper size from PDF file and set the paper size to target printer, it is same as "Choose paper source by PDF" option in Adobe Acrobat software.

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

This entry was posted in Advanced PDF Tools, DocConverter COM, PDF Print and tagged , , , , . Bookmark the permalink.

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!