How to control page orientation when convert HTML file to PDF file using html2pdf.exe application?

Hi,

I am creating a function for exporting the html to pdf format doc, but i want to make the pdf in landscape, is that possible to done with html2pdf.exe? anyway, i am using asp.net with C#. if possible, can provide any sample code?

Thank you very much!
Customer
---------------------------------------------------------------

Are you using the DocConverter COM and html2pdf.exe application now? if yes, you can use command lines to convert HTML file to PDF file in landscape mode easily.

How to test DocConverter COM (and html2pdf.exe)?

Step 1: Please install the PDFcamp Printer or PDFcamp Printer Pro into your system first,

http://www.verypdf.com/app/pdfcamp-printer/doc-converter-com.html
http://www.verypdf.com/pdfcamp/pdfcamp_setup.exe
http://www.toppdf.com/pdfcamp/doc2pdf_com_trial.zip

Step 2: Please click "install_as_exe.bat" or "install_as_service.bat" file to install the DocConverter COM,

Step 3: You can run HTML2PDF.exe from command line to test its capabilities.

Examples for HTML2PDF.exe software:

Use Letter paper in portrait mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "papertype=0"

Use Letter paper in landscape mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=792,pageHeight=612"

Use A4 paper in portrait mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "papertype=7"

Use A4 paper in landscape mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=842,pageHeight=595"

Use A3 paper in portrait mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "papertype=6"

Use A3 paper in landscape mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=1190,pageHeight=842"

Use A1 paper in portrait mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=1684,pageHeight=2384"

Use A2 paper in landscape mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=1191,pageHeight=1684"

Use A3 paper in landscape mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=842,pageHeight=1191"

Use A4 paper in landscape mode,

html2pdf.exe "http://www.google.com" "C:\google.pdf" "paperType=9,pageWidth=595,pageHeight=842"

You can select more paper types for "papertype" value,
~~~~~~~~~~~~~~~~~
    Set page type, the value is from 0 to 9,
    0 "Letter [8.5 x 11 in]",
    1 "Legal [8.5 x 14 in]",
    2 "Executive [7.25 x 10.5 in]",
    3 "Ledger [355.6 x 215.9 mm]",
    4 "Tabloid [11 x 17 in]",
    5 "Screen [10 x 7.5 in]",
    6 "A3 [297 x 420 mm]",
    7 "A4 [210 x 297 mm]",
    8 "A5 [148 x 210 mm]",
~~~~~~~~~~~~~~~~~

Set page header&footer for HTML to PDF conversion,

"html2pdf.exe" "www.yahoo.com" "C:\yahoo.pdf" "htmlHeaders=this is header,htmlFooters=this is footer"

Set values for page header&footer within HTML to PDF conversion,

"html2pdf.exe" "www.yahoo.com" "C:\yahoo.pdf" "htmlHeaders=&w&bPage &p/&P,htmlFooters=&u&b&d"

Set passwords for DOC, HTML, PPT, XLS, RTF, etc. document to PDF conversion,

"html2pdf.exe" "C:/Doc1.DOC" "C:/Doc1.pdf" "Encryption=2,EncryBits=16,Permission=0,UserPass=,OwnerPass=123"

Set page margin for conversion,

"html2pdf.exe" "http://www.yahoo.com" "C:/yahoo.pdf" "paperType=9,pageWidth=575,pageHeight=850,margin_left=10,
margin_top=40,margin_right=10,margin_bottom=40"

Set username & password for encrypted site to PDF conversion,

html2pdf "http://www.xxxxxx.com/index.html" "C:/output.pdf" "postdata=Username=support@verypdf.com&Password=password"

Append "C:/test.txt" file to the end of "C:/output.pdf" file,

"html2pdf.exe" "C:/test.txt" "C:/output.pdf" "AutomaticValue=4,Overwrite=yes"
"html2pdf.exe" "C:/test.doc" "C:/output.pdf" "AutomaticValue=4,Overwrite=yes"
"html2pdf.exe" "C:/test.html" "C:/output.pdf" "AutomaticValue=4,Overwrite=yes"

Insert "C:/test.txt" file before the first page of "C:/output.pdf" file,

"html2pdf.exe" "C:/test.txt" "C:/output.pdf" "AutomaticValue=3,Overwrite=yes"
"html2pdf.exe" "C:/test.doc" "C:/output.pdf" "AutomaticValue=3,Overwrite=yes"
"html2pdf.exe" "C:/test.html" "C:/output.pdf" "AutomaticValue=3,Overwrite=yes"

Overwrite to an existing PDF file,

"html2pdf.exe" "C:/test.doc" "C:/output.pdf" "Overwrite=yes"

Convert a HTML file which contains Javascript, Java Applet, SVG, Flash or iFrame codes to PDF file,
(You need wait more than 10000 millisecond before convert such HTML files)

"html2pdf.exe" "C:/javascript_test.htm" "C:/output.pdf" "EnableSupportApplet=yes,DelayTimeForPrintApplet=10000"

Convert background color and images within html to pdf conversion,

"html2pdf.exe" "http://www.verypdf.com/pdfcamp/pdfcamp.htm" "C:/output.pdf" "PrintHTMLBackground=yes"

"html2pdf.exe" "http://www.verypdf.com/pdfcamp/pdfcamp.htm" "C:/output.pdf" "PrintHTMLBackground=no"

Show status bar within HTML to PDF conversion,

"html2pdf.exe" "http://www.verypdf.com/pdfcamp/pdfcamp.htm" "C:/output.pdf" "showStatusBar=on"

"html2pdf.exe" "http://www.verypdf.com/" "C:/output.pdf" "showStatusBar=on,wndleft=0,wndtop=0,wndwidth=1024,wndheight=768,overwrite=yes"

Deliver a command line to "doc2pdf_service.exe" Service Application,
(Please notice, you need make sure "doc2pdf_service.exe" is running before you run this command line)

"html2pdf.exe" "http://www.verypdf.com" "%CD%\output.pdf" "AutomaticValue=4,Overwrite=yes,KillProcess=no,doc2pdf_service=yes"

The port number value in doc2pdf_config.ini file is used by "doc2pdf_service.exe" application, it is same as the "port" parameter in command line. The default PORT number is 54321, if this default PORT number is failed, you can specify a new PORT number in both doc2pdf_config.ini file and command line,

"html2pdf.exe" "http://www.verypdf.com" "%CD%\output.pdf" "AutomaticValue=4,Overwrite=yes,KillProcess=no,doc2pdf_service=yes,port=54323"

Change paper orientation for PDFcamp Printer Driver,
Use A4 paper in PORTRAIT mode,

"html2pdf.exe" "http://www.verypdf.com" "C:/verypdf.pdf" "papertype=7,orientation=1"

Use A4 paper in LANDSCAPE mode,

"html2pdf.exe" "http://www.verypdf.com" "C:/verypdf.pdf" "papertype=7,orientation=2"

Use Letter paper in portrait mode,

"html2pdf.exe" "http://www.verypdf.com" "C:/verypdf.pdf" "papertype=0,orientation=1"

Use Letter paper in landscape mode,

"html2pdf.exe" "http://www.verypdf.com" "C:/verypdf.pdf" "papertype=0,orientation=2"

Print special sheets from XLS document to PDF file,
(You can specify the sheets's name with "ExcelSheets" parameter, you can use "|" symbol to convert several sheets into one PDF file.)

html2pdf.exe "C:\1.XLS" "C:\1.pdf" "ExcelSheets=Sheet1|Sheet2"

Convert sheet 1 and sheet 2 to PDF file (by index),

html2pdf.exe "C:\1.XLS" "C:\1.pdf" "ExcelSheets=1|2"

Print special sheet range from XLS document to PDF file,

html2pdf.exe "C:\1.XLS" "C:\1.pdf" "ExcelSheets=Sheet1,sheetrange=A1:C3"

Suppress error messages during conversion and copy the problem file to a special folder,

"html2pdf.exe" "http://www.verypdf.com" "C:/verypdf.pdf" "Overwrite=yes,silenterrors=1,copyerrfile=C:\"

Examples for doc2pdf_service.exe software:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The "doc2pdf_service.exe" supports two methods, run as a Windows System
Service and run as a Normal Windows Application,

1. Run As a Normal Windows Application

C:\>doc2pdf_service.exe "-exe"
This Command Line will run doc2pdf_service.exe as a normal windows application.

2. Run As a Windows Service

C:\>doc2pdf_service.exe -i
This Command Line will install the "VeryPDF DocConverter COM Service" into your
system.

C:\>doc2pdf_service.exe -u
This Command Line will uninstall the "VeryPDF DocConverter COM Service" from
your system.

C:\>net start "VeryPDF DocConverter COM Service"
C:\>net stop "VeryPDF DocConverter COM Service"
Above Command Lines will start/stop "VeryPDF DocConverter COM Service" from
your system.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

VeryPDF

Relevant Articles:

How to call html2pdf.exe from ASP, ASP.NET, C#, JSP, etc. code on Windows 2008 64bit system?

http://www.verypdf.com/wordpress/201403/how-to-call-html2pdf-exe-docconverter-com-from-asp-code-on-windows-2008-r2-64bit-system-directly-40351.html

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)
Posted in DocConverter COM | Tagged , | Leave a comment

Use VeryPDF Cloud API Platform to edit PDF, Word, DOC, DOCX, Excel, XLS, XLSX, PowerPoint, PPT, PPTX, etc. document formats online. Convert Word, PDF, Office document to Text Box format easily.

Hi,

I am looking at your PDF solutions and I am curious to get your opinion if one of your solutions will accomplish what I am looking to do.

* We run on Windows Server 2012

* Our application is ASP.Net MVC 4

* We use MS SQL 2012

* We use Essential Objects PDF to export completed files.

What we are trying to accomplish:

We need to give our clients the ability to type a new document from scratch into a Rich Text Editor text box, which is our existing setup. The problem with this I our clients want to copy and paste from an existing word document, write into the text box, and expect to retain all special formatting such as bold, different size fonts, underlines, italics, bullets, etc. This has proven impossible and takes a lot time to type in the text box from scratch.

What we would like to do is give our clients the option to upload a PDF or Word doc version of the document they want to import to our application. We want to incorporate a solution (VeryPDF?) that will read all text and formatting, and place that text in the same formatting into our existing text boxes on our application. The catch is, once the text from the PDF or Word Doc (while retaining original formatting) is transferred to our text box on our web page, we also need it to remain editable on the User Interface side.

Obviously we will have to write code as well, but is VeryPDF capable of reading PDF and Word docs and transferring that info to our text box while retaining all original formatting?

Thank you for your prompt reply.

Customer
----------------------------------------------------------------------------

image
Yes, this is possible with VeryPDF Cloud API Platform.

You can test with "VeryPDF Free Online Document Editor" online APP, this is a simple online word editor application which almost meet your requirement, you can upload various document formats and edit them in an Online Word Editor easily,

http://www.verypdf.com/online/free-online-document-editor.php

after you subscribe the VeryPDF Cloud API Platform, you can use its functions to convert various uploaded document formats to a simple HTML file, then you can analyze this HTML file and convert elements into your predefined text box format, this can be done easily.

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)
Posted in VeryPDF Cloud API | Tagged , | Leave a comment

Use VeryPDF Cloud API Platform to convert dynamic web pages to PDF files, Convert dynamic URLs to PDF files

Hi,

I just purchased the API key for HTML to PDF converter and when I test it I get an error: "[Error] Failed to get document URL". My API key is XXXXXXXXXXXXXX.

Here is the testing with API call url,

http://www.verypdf.com/search/search.php?query=pdf%20to%20word&search=1

This is the code inside of test.php,

function htmltopdfsdk()
{
$apikey = "XXXXXXXXXXXXX";
$inputfile = "http://www.verypdf.com/search/search.php?query=pdf%20to%20word&search=1";
$url = "http://online.verypdf.com/app/onlineapi/";
$postfields = "apikey=" . $apikey ."&inputfile=". $inputfile . "&type=htmltopdfsdk&--title=mywebsite";

$pdf = http_post($url, $postfields);
echo $pdf;
}

htmltopdfsdk(); // uncomment this line to convert HTML to PDF

function http_post($url, $postfields)
{
if (!function_exists("curl_init"))
{
return "missing curl";
}
$c = curl_init();
curl_setopt($c, CURLOPT_URL,$url);
curl_setopt($c, CURLOPT_HEADER, false);
curl_setopt($c, CURLOPT_CONNECTTIMEOUT, 100);
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
curl_setopt($c, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($c, CURLOPT_DNS_USE_GLOBAL_CACHE, false);
curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);

$http_code = 0;
$error = "";

$response = curl_exec($c);
$http_code = curl_getinfo($c, CURLINFO_HTTP_CODE);
$error_str = curl_error($c);
$error_nr = curl_errno($c);
curl_close($c);

if ($error_nr != 0) {
echo "info1:error ".$error_nr;
}
else if ($http_code == 200) {
return $response;
} else {
echo "info2:error ".$http_code;
}
}
?>

I got this code from your website, and just replaced the api key and url. Am I doing something wrong. Please help.

Thanks,
Customer
----------------------------------------------------------------

image
Because your URL is contain "?" and "=" keywords, these keywords will conflict with VeryPDF Cloud API URL, so you MUST use urlencode() function to encode this URL before pass it to VeryPDF Cloud API, please refer to the function of urlencode() from following web page,

http://us2.php.net/urlencode

You can use following sample PHP code to test the encoding and decoding the URLs,

<?php

$strURL = 'http://www.verypdf.com/search/search.php?query=pdf%20to%20word&search=1';
$strURL2 = urlencode ( $strURL );
echo $strURL2 . "<br>";
echo urldecode ( $strURL2 ) . "<br><br>";

$strURL = 'http://us2.php.net/urlencode';
$strURL2 = urlencode ( $strURL );
echo $strURL2 . "<br>";
echo urldecode ( $strURL2 ) . "<br><br>";
?>

Original URL is:

http://www.verypdf.com/search/search.php?query=pdf%20to%20word&search=1

Encoded URL is:

http%3A%2F%2Fwww.verypdf.com%2Fsearch%2Fsearch.php%3Fquery
%3Dpdf%2520to%2520word%26search%3D1

You can execute following URL to convert your dynamic web page to PDF file easily,

http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2pdf&infile=http%3A%2F%2Fwww.verypdf.com
%2Fsearch%2Fsearch.php%3Fquery%3Dpdf%2520to%2520word%26search
%3D1&outfile=verypdf.pdf

If you want to add header or footer into PDF pages, please execute following URL,

http://online.verypdf.com/api/?apikey=XXXXXXXXXXXXX&app=html2pdf&infile=http%3A%2F%2Fwww.verypdf.com
%2Fsearch%2Fsearch.php%3Fquery%3Dpdf%2520to%2520word%26search
%3D1&outfile=verypdf.pdf&--header-left=mywebsite&--footer-left=verypdf%20page
%20footer

You may refer to more options which included in html2pdf APP from following web page,

http://www.verypdf.com/wordpress/201308/verypdf-cloud-api-platform-web-page-to-pdf-image-converter-cloud-api-convert-web-page-to-pdf-and-image-files-website-screenshot-web-page-snapshot-capture-full-web-page-screenshots-37937.html

btw, if your web page contains large images, html2pdf APP may break these images, in order to handle page breaking in large images, you can put these images into a div, such as,

HTML:

<div class="Image"><img src=http://localhost/testimage.jpg></div>

CSS:

img {
page-break-inside: avoid;
}
.Image{
page-break-inside: avoid;
}

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)
Posted in VeryPDF Cloud API | Tagged , | Leave a comment

PDFTOOLBOX merge multiple pdf files into one pdf file

Sir, Misses,

I tried to merge pdf files with pdftoolbox *.pdf -merge -outfile result.pdf, but the pdf toolbox doesn't generate the output file.

If I try pdftoolbox a.pdf b.pdf -merge -outfile result.pdf it works fine, but I need to merge multiple pdf files (more than 100) into 1 pdf file.

Why the *.pdf method is not working?

Sincerely,
Customer
--------------------------------------------------

image
You can run following command line to merge all PDF files into one PDF file easily,

pdftoolbox.exe sample_in*.pdf -merge -outfile _mergeall_out.pdf

OR

pdftoolbox.exe *.pdf -merge -outfile _mergeall_out.pdf

Please refer to following web page for more information,

http://www.verypdf.com/wordpress/201304/decrypt-pdf-and-merge-it-with-another-pdf-by-pdf-toolbox-36080.html

http://www.verypdf.com/wordpress/201205/how-to-use-verypdf-pdftoolbox-to-merge-pdf-27411.html

You can create a .txt file to include all filenames, and use PDF Split-Merge Command Line software to merge all PDF files from this .txt file into a single output PDF file,

http://www.verypdf.com/wordpress/201401/batch-merge-all-pdf-files-in-a-folder-to-single-output-pdf-file-40239.html

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)
Posted in PDF Toolbox Command Line | Tagged , , | Leave a comment

Convert Word to PDF and encrypt the PDF file with a password using command line

Hi there,

I am trying to convert Word to PDF and also encrypt the document with a password using the command line. I can convert the document fine and it says SECURED at the top but it doesn't ask for a password to open it. Is there a way to do this (v5 docprint pro)

Thanks,
Customer
----------------------------------
You can download and install docPrint Pro v6.0 from following web page first,

http://www.verypdf.com/app/document-converter/try-and-buy.html
http://www.verypdf.com/artprint/docprint_pro_setup.exe

then you can run following command line to convert your DOC, DOCX or other formats to PDF files with two passwords,

"C:\Program Files (x86)\docPrint Pro v6.0\doc2pdf.exe" -i D:\temp\test.docx -o D:\temp\out.pdf -s openpwd=123 -s ownerpwd=456 -s keylen=0 -s permission=3900

When you open the output PDF file, you will be required to input the open password.

image

image

image

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)
Posted in docPrint Pro | Tagged , | Leave a comment
Page 1 of 1,26212345...102030...Last »