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)

Related Posts

This entry was posted in DocConverter COM 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!