Tuesday, July 19, 2011

Converting Text file to PDF and TIFF without "Save As" dialogue

As a part of Systems Architect job, you got unique client request almost daily.

In my case client wanted to convert text file to PDF and TIFF file. After conversion they wanted to load into Quantum software.
 
Most of the hospital lab result from PISCAS and other software's were in HL7 Messages and also ASCII text file format but to store in Quantum files must be converted to PDF or TIFF, It was necessary step to convert to PDF or TIFF.

After doing some research i got interesting idea for conversion. Instead of using third part converters, I used standard printer drivers and Word Pad.

I used the following tools

1) Word Pad
2) PDF printer driver
3) "Microsoft Office Document Image Writer" printer driver






I used following command to convert files.

C:\>wordpad.exe /pt "SourceFileName&Path" "TargetPrinterDriver"

/pt is for silent conversion.

"Microsoft Office Document Image Viewer" Silent Mode:

Please change the following Registery of Settings "MyComputer\HCU\Softwares\Microsoft\Office\12.0\MODI\MDI writer" for "Microsoft Office Document Image Viewer"  in order to convert file in silent mode.
 
 
 
 
There are two important settings are OpenInMODI and PrivateFlags.
OpenInMODI should be "0" but remember sometime you need to assign decimal 0 value manually.
PrivateFlags should be 11 in Hexa decimal and data should show (17)

"Acorbat PDF Converter" Silent Mode:
For Adobe silent mode conversion you need to change the printer driver settings. Click on the printer and then click on select printing preference (Xp)
 

Change the Adode PDF output folder to MyDocument\*.pdf or browse your own folder.


  Once you are done click "ok"

Following command will convert the file in silent mode


C:\>"C:\Program Files\Windows NT\Accessories\wordpad.exe" /pt C:\admit.txt "Microsoft Office Document Image Writer"


C:\>"C:\Program Files\Windows NT\Accessories\wordpad.exe" /pt C:\admit.txt AdobePDF

By default all files will be generated in the "My Document" Folder  until you change it in the settings.


Some interesting post i discover

Really nice file conversion online utility:
http://www.freefileconvert.com/



Some useful links for file conversion:

http://www.robvanderwoude.com/commandlineswitches.php#XpsViewer

http://social.msdn.microsoft.com/Forums/en/isvvba/thread/c5ae166b-84d0-4de7-b65f-b50cca8b3b32

http://www.robvanderwoude.com/printfiles.php

No comments:

Post a Comment