38
Foxit Convert2PDF User Manual
www.foxitsoftware.com
19
convert2pdf -i “test\*.png” -o output.pdf
7)
Convert only BMP, DOC and TEXT files in a folder to PDF files:
convert2pdf -i “c:\input\*.bmp,*.doc,*.txt” -o d:\output
convert2pdf -i “test\*.bmp,*.doc,*.txt” -o output
3.3.2
File Types Selection for Conversion
The optional argument (-modetype) is used to specify the file types to be converted. If this argument
is not set or if it is set to “1,2,3,4”, all the files (image, text, html, and Office) will be converted. For
more details about this argument, please refer to section 3.2 “Command Line Summary”.
Usage Example
1)
Convert image files to PDF files: (-modetype “1”)
convert2pdf -i c:\input -o d:\output -modetype “1”
convert2pdf -i test -o output -modetype “1”
2)
Convert text and html files to PDF files: (-modetype “3,4”)
convert2pdf -i c:\input -o d:\output -modetype “3,4”
convert2pdf -i test -o output -modetype “3,4”
3)
Convert Office, text and html files to PDF files: (-modetype “2,3,4”)
convert2pdf -i c:\input -o d:\output -modetype “2,3,4”
convert2pdf -i test -o output -modetype “2,3,4”
3.3.3
Settings for Image, Text, and Html Conversion
a)
Page size setting (-width, -height)
The optional arguments (-width) and (-height) are used to set the page width and height for the
output PDF file in points. They are valid only for image, text, and html conversion. For image
conversion, the default value is the width and height of the input image; for text conversion, the
default width and height are 595 and 842 points respectively with the allowable range of 8-14400
points; for html conversion, the default width and height are 842 and 595 points respectively with
the allowable range of 16-14400 points.
37
Foxit Convert2PDF User Manual
www.foxitsoftware.com
20
Note For image conversion, the -width and -height options must be used together with a set value
greater than 0.
Usage Example
1)
Set the page width and height to 400 and 300 for the output PDF file (-width 400 -height 300)
convert2pdf -i c:\input\image_1.jpg -o d:\output\image_1.pdf -width 400 -height 300
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -width 400 -height 300
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -width 400 -height 300
convert2pdf -i c:\input -o d:\output -width 400 -height 300
convert2pdf -i test -o output -width 400 -height 300
convert2pdf -i “c:\input\*.png” -o d:\output -width 400 -height 300
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -width 400 -height 300
convert2pdf -i “c:\input\*.jpg,*.txt,*.html” -o d:\output -width 400 -height 300
b)
Margin setting (-margin)
The optional argument (-margin) is used to set size of margin for each PDF page in points. It is valid
only for image, text, and html conversion. For image conversion, the default value for each margin is
0; for text conversion, the default values are 60 72 60 72; and for html conversion, the default values
are 10 10 10 10. For more details about this argument, please refer to section 3.2 “Command Line
Summary”.
Note The sum of the left and right values must be less than the width of the page, and the sum of the top
and bottom values must be less than the height of the page.
Usage Example
1)
Set the left margin to 20 points (-margin 20)
convert2pdf -i c:\input\image_1.jpg -o d:\output\image_1.pdf -margin 20
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -margin 20
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -margin 20
convert2pdf -i c:\input -o d:\output -margin 20
convert2pdf -i test -o output -margin 20
convert2pdf -i “c:\input\*.png” -o d:\output -margin 20
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -margin 20
convert2pdf -i “c:\input\*.jpg,*.txt,*.html” -o d:\output -margin 20
C# WPF PDF Viewer SDK to annotate PDF document in C#.NET Text box. Click to add a text box to specific location on PDF page. Line color and fill can be set in properties. Copyright © <2000-2016> by <RasterEdge.com>.
how to save pdf form data in reader; how to make pdf editable form reader
39
Foxit Convert2PDF User Manual
www.foxitsoftware.com
21
2)
Set the left margin to 20 points, and the top margin to 10 points (-margin 20 10)
convert2pdf -i c:\input\image_1.jpg -o d:\output\image_1.pdf -margin 20 10
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -margin 20 10
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -margin 20 10
convert2pdf -i c:\input -o d:\output -margin 20 10
convert2pdf -i test -o output -margin 20 10
convert2pdf -i “c:\input\*.png” -o d:\output -margin 20 10
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -margin 20 10
convert2pdf -i “c:\input\*.jpg,*.txt,*.html” -o d:\output -margin 20 10
3)
Set the left margin to 10 points, the top margin to 10 points and the right margin to 30 points (-
margin 10 10 30)
convert2pdf -i c:\input\image_1.jpg -o d:\output\image_1.pdf -margin 10 10 30
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -margin 10 10 30
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -margin 10 10 30
convert2pdf -i c:\input -o d:\output -margin 10 10 30
convert2pdf -i test -o output -margin 10 10 30
convert2pdf -i “c:\input\*.png” -o d:\output -margin 10 10 30
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -margin 10 10 30
convert2pdf -i “c:\input\*.jpg,*.txt,*.html” -o d:\output -margin 10 10 30
4)
Set the left margin to 10 points, the top margin to 10 points, the right margin to 30 points and the
bottom margin to 20 points (-margin 10 10 30 20)
convert2pdf -i c:\input\image_1.jpg -o d:\output\image_1.pdf -margin 10 10 30 20
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -margin 10 10 30 20
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -margin 10 10 30 20
convert2pdf -i c:\input -o d:\output -margin 10 10 30 20
convert2pdf -i test -o output -margin 10 10 30 20
convert2pdf -i “c:\input\*.png” -o d:\output -margin 10 10 30 20
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -margin 10 10 30 20
convert2pdf -i “c:\input\*.jpg,*.txt,*.html” -o d:\output -margin 10 10 30 20
3.3.4
Settings for Text Conversion
a)
Text font (-font)
38
Foxit Convert2PDF User Manual
www.foxitsoftware.com
22
The optional arguments (-font) is used to set the font style for text conversion. It is valid only for text
conversion.
Note The font style you set should be installed on a local environment, otherwise the default font
style will be used.
Usage Example
1)
Set the font style to “ alibri” for text conversion (-font “Calibri”)
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -font “Calibri”
convert2pdf -i test\text_2.txt -o output\text_2.pdf -font “ alibri”
convert2pdf -i c:\input -o d:\output -font “ alibri”
convert2pdf -i test -o output -font “ alibri”
convert2pdf -i “c:\input\*.txt” -o d:\output -font “ alibri”
b)
Text font size (-fs)
The optional argument (-fs) is used to set the font size for text conversion. It is valid only for text
conversion. The default value is set to 9, and the allowable range is from 8 to 72.
Usage Example
1)
Set the font size to 12 for text conversion (-fs 12)
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -fs 12
convert2pdf -i test\text_2.txt -o output\text_2.pdf -fs 12
convert2pdf -i c:\input -o d:\output -fs 12
convert2pdf -i test -o output -fs 12
convert2pdf -i “c:\input\*.txt” -o d:\output -fs 12
c)
Text font color (-fontcolor)
The optional argument (-fontcolor) is used to set the font color for text conversion. It is valid only for
text conversion. By default, the font color is black. The allowable range of the values for each RGB
component is from 0 to 255.
Usage Example
1)
Set the font color to blue (-fontcolor 0 0 255)
39
Foxit Convert2PDF User Manual
www.foxitsoftware.com
23
convert2pdf -i c:\input\text_1.txt -o d:\output\text_1.pdf -fontcolor 0 0 255
convert2pdf -i test\text_2.txt -o output\text_2.pdf -fontcolor 0 0 255
convert2pdf -i c:\input -o d:\output -fontcolor 0 0 255
convert2pdf -i test -o output -fontcolor 0 0 255
convert2pdf -i “c:\input\*.txt” -o d:\output -fontcolor 0 0 255
3.3.5
Settings for Html Conversion
a)
Cache address (-cache)
The optional argument (-cache) is used to set cache address to store html page resources
temporarily. The page resources of the converted webpage will be downloaded and stored to this
cache address first, and then will be deleted after conversion. If this argument is not set, a folder
named “cache” will be generated in the installation folder. It is valid only for html conversion.
Usage Example
1)
Set cache address to “d:\resources” (-cache “d:\resources”)
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -cache “d:\resources”
convert2pdf -i test\html_2.html -o output\html_2.pdf -cache “d:\resources”
convert2pdf -i c:\input -o d:\output -cache “d:\resources”
convert2pdf -i test -o output -cache “d:\resources”
convert2pdf -i “c:\input\*.html” -o d:\output -cache “d:\resources”
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -cache “d:\resources”
b)
Timeout for loading (-timeout)
The optional argument (-timeout) is used to set timeout in seconds to load webpages. The webpages
will not continue to be loaded when the time is used up. The default value is 120s, and the timeout
value will be set to 15 if users set a value less than 15. This argument is valid only for html conversion.
Usage Example
1)
Set the timeout to “200s” to load webpages (-timeout 200)
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -timeout 200
convert2pdf -i test\html_2.html -o output\html_2.pdf -timeout 200
convert2pdf -i c:\input -o d:\output -timeout 200
convert2pdf -i test -o output -timeout 200
36
Foxit Convert2PDF User Manual
www.foxitsoftware.com
24
convert2pdf -i “c:\input\*.html” -o d:\output -timeout 200
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -timeout 200
c)
Single page (-singlepage)
The optional argument (-singlepage) is used to set all the page contents to one single PDF page. It is
valid only for html conversion.
Usage Example
1)
Set all the page contents to one single PDF page (-singlepage)
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -singlepage
convert2pdf -i test\html_2.html -o output\html_2.pdf -singlepage
convert2pdf -i c:\input -o d:\output -singlepage
convert2pdf -i test -o output -singlepage
convert2pdf -i “c:\input\*.html” -o d:\output -singlepage
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -singlepage
d)
Disable retaining hyperlinks (-nolink)
The optional argument (-nolink) is used to convert the input to PDF files with no link annotations
retained. If users set this argument, no action will be triggered when they click the links in the output
PDF file.
Usage Example
1)
Convert the input to PDF files with no link annotations (-nolink)
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -nolink
convert2pdf -i test\html_2.html -o output\html_2.pdf -nolink
convert2pdf -i c:\input -o d:\output -nolink
convert2pdf -i test -o output -nolink
convert2pdf -i “c:\input\*.html” -o d:\output -nolink
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -nolink
e)
Page rotation (-rotate)
39
Foxit Convert2PDF User Manual
www.foxitsoftware.com
25
The optional argument (-rotate) is used to set page rotation for the output PDF files. The setting
value must be 0, 90, 180 or 270 and the default value is 0. This argument is valid only for html
conversion.
Usage Example
1)
Set page rotation to 90 degree (-rotate 90)
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -rotate 90
convert2pdf -i test\html_2.html -o output\html_2.pdf -rotate 90
convert2pdf -i c:\input -o d:\output -rotate 90
convert2pdf -i test -o output -rotate 90
convert2pdf -i “c:\input\*.html” -o d:\output -rotate 90
convert2pdf -i “www.foxitsoftware.com” -o d:\output\foxit.pdf -rotate 90
f)
Check lazy load (-checklazyload)
The optional argument (-checklazyload) is used to improve the conversion quality if the webpages
include lazy loading elements or if the network/hardware performance is not good enough. This
argument is valid only for html conversion.
Note The -checklazyload argument is useful in the following two situations:
Some special long webpages use lazy loading design pattern to make the page load faster
and reduce server load, therefore some web elements are designed to be delayed loading,
which will affect the conversion quality.
If the network or hardware performance is not good enough, the web elements loading will
be influenced, which will also affect the conversion quality.
If this argument is set, the tool will spend at least 5 seconds waiting for loading the web elements
before starting conversion, which can help improve the conversion quality.
Usage Example
1)
Improve the conversion quality if the webpages include lazy loading elements or if the
network/hardware performance is not good enough (-checklazyload)
convert2pdf -i c:\input\html_1.html -o d:\output\html_1.pdf -rotate 90
convert2pdf -i test\html_2.html -o output\html_2.pdf -rotate 90
convert2pdf -i c:\input -o d:\output -rotate 90
39
Foxit Convert2PDF User Manual
www.foxitsoftware.com
26
convert2pdf -i test -o output -rotate 90
convert2pdf -i “c:\input\*.html” -o d:\output -rotate 90
convert2pdf -i “www.foxitsoftware.com” -o output -checklazyload
3.3.6
Settings for Office Conversion
a)
Scale (-scale)
The optional argument (-scale) is used to specify a conversion mode for Microsoft Excel files. For
more details about this argument, please refer to the section 3.2 “Command Line Summary”.
Note This argument is supported on the version higher than Microsoft Office 2007 and it is valid only
for Microsoft Excel files conversion.
Usage Example
1)
Convert sheets at their actual size (-scale 0)
convert2pdf -i c:\input\1.xlsx -o d:\output\1.pdf -scale 0
convert2pdf -i c:\input -o d:\output -scale 0
convert2pdf -i test -o output -scale 0
convert2pdf -i “c:\input\*.xls” -o d:\output -scale 0
2)
Fit all columns on one page (-scale 1)
convert2pdf -i c:\input\1.xlsx -o d:\output\1.pdf -scale 1
convert2pdf -i c:\input -o d:\output -scale 1
convert2pdf -i test -o output -scale 1
convert2pdf -i “c:\input\*.xls” -o d:\output -scale 1
3)
Fit all rows on one page (-scale 2)
convert2pdf -i c:\input\1.xlsx -o d:\output\1.pdf -scale 2
convert2pdf -i c:\input -o d:\output -scale 2
convert2pdf -i test -o output -scale 2
convert2pdf -i “c:\input\*.xls” -o d:\output -scale 2
4)
Fit sheet on one page (-scale 3)
convert2pdf -i c:\input\1.xlsx -o d:\output\1.pdf -scale 3
convert2pdf -i c:\input -o d:\output -scale 3
convert2pdf -i test -o output -scale 3
36
Foxit Convert2PDF User Manual
www.foxitsoftware.com
27
convert2pdf -i “c:\input\*.xls” -o d:\output -scale 3
b)
Open password (-op)
The optional argument (-op) indicates the open password for a password-protected input file. It is
not required if the input file is not password protected. This argument is valid only for Office
conversion.
Note The output PDF file will not retain the open password from the input file.
Usage Example
1)
Specify the open password for a password-protected input Office file (-op 123)
convert2pdf -i c:\input\1.docx -o d:\output\1.pdf -op 123
convert2pdf -i test\2.pptx -o output\2.pdf -op 123
2)
Specify the open password for all input Office files that have been protected with the same password
(-op 123)
convert2pdf -i c:\input -o d:\output -op 123
convert2pdf -i test -o output -op 123
Note It only supports typing one value for the argument (-op). Only files with the same open
password can be processed together and files with different open password need to be processed
separately.
3.3.7
Recursion Depth of Sub-folders
The optional argument (-r) indicates the recursion depth of sub-folders, which is valid only when the
input is a folder or a path that includes wildcard character like “c:\input\*.doc”. By default, the
recursion depth is 1, so the sub-folders will not be processed. For more details about this argument,
please refer to section 3.2 “Command Line Summary”.
Usage Examples
1)
Search the full folders (-r or -r 0)
convert2pdf -i test -o output -r
convert2pdf -i c:\input -o d:\output -r
Documents you may be interested
Documents you may be interested