In this article, I will show you one method of converting text to PDF in batch by command line and control viewing mode when you open output in Adobe PDF Reader. Meanwhile, this method can be used to convert DOC, DOCX, DOCM, RTF, TXT, PPT, PPTX, XLS, XLSX, OpenOffice ODT, HTML, MHTML files to PDF and control viewing mode.
The great part of this method is software VeryDOC DOC to Any Converter. If you use server version or developer version of DOC to Any Converter,there is also integrated COM object (or DLL Library, or Command Line) availbel, enabling developers to access the converter via any programming or scripting languages, such as Visual Basic, C/C++, Delphi, ASP, PHP, C#, .NET, etc. In the following part, I will show you how to use it.
Step 1. Download DOC to Any Converter Command Line
All the VeryDOC Licenses are perpetual, once you pay for it then you can use it forever if you do not change software environment or need to update it to the latest version.
- Once downloading finishes, there will be a zip file. Please unzip it and then check the elements in it.
Step 2. Convert text to PDF and control viewing mode
- It is necessary to read help document before running this software. And when you use it, please obey rules and examples.
- Usage: DOC2Any [options] <in-file> [<out-file>]
- When you need to convert text to PDF, please refer to the following command line.
doc2any.exe C:\in.txt C:\out.pdf
doc2any.exe C:\*.txt C:\*.pdf
for %F in (D:\test\*.txt) do "doc2any.exe" "%F" "%~dpnF.pdf"
- When you need to convert text to PDF and control view mode, please refer to the following command line.
doc2any.exe -viewerzoom 1600 -viewpage 10 -viewpagemode 2 -view "C:\in.doc" C:\out.pdf
Now let us check related parameters:
-viewpagemode <int> : Set page mode that is used when opening the document in Adobe Reader
-viewpagemode 0: No page mode is applied, default option
-viewpagemode 1: Show outline tree
-viewpagemode 2: Show thumbnails
-viewpagemode 3: Open the document in full-screen mode
-viewpagemode 4: UseOC
-viewpagemode 5: UseAttachments
-vieweropt <int> : Set viewer preferences to Adobe Reader
-vieweropt 1: HideToolBar
-vieweropt 2: HideMenuBar
-vieweropt 4: HideWindowUI
-vieweropt 8: FitWindow
-vieweropt 16: CenterWindow
-vieweropt 32: DisplayDocTitle
-vieweropt 64: Non-FullScreenPageMode, use -viewerval to set more options
-viewerval <int> : Additional values used by -vieweropt 64
-vieweropt 64 -viewerval 1 : UseNone
-vieweropt 64 -viewerval 2 : UseOutlines
-vieweropt 64 -viewerval 4 : UseThumbs
-vieweropt 64 -viewerval 1024: UseOC
-viewerzoom <string> : Set viewer zoom ratio to Adobe Reader
-viewerzoom FitBH: Display pages to fit the width of its bounding box
-viewerzoom FitH : Display pages to fit the width of page
-viewerzoom Fit : Display pages to fit window
-viewerzoom FitV : Display pages to fit height of page
-viewerzoom FitB : Display pages to fit its bounding box entirely
-viewerzoom FitBV: Display pages to fit height of its bounding box
-viewerzoom 25 : Display pages with magnification at 25%%
-viewerzoom 50 : Display pages with magnification at 50%%
-viewerzoom 1600 : Display pages with magnification at 1600%%
-viewpage <string> : set start page when opening it in Adobe Reader
-view : View PDF file after creation
Please check above parameters and usage carefully then add corresponding parameters according to your needs. By those parameters, you can convert text to PDF and control viewing mode. During the using, if you have any question, please contact us as soon as possible.