convert .doc file to .pdf file in C#

Hello,

I need to convert a .doc file to .pdf file in dot net using C# . Any help will be highly appreciated.

Thanks

1
vivek_vats
11/11/2008 12:10:43 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

5 Replies
1902 Views

Similar Articles

[PageSpeed] 26

Hello,

Please check the link below.

http://www.codeproject.com/KB/cs/sertf2pdf.aspx

Hope it will help you, do let me know if it helps you.


S.SRIRAM
1
s
11/11/2008 12:57:44 PM

Thanks for your reply but it is not working. 

-1
vivek_vats
11/11/2008 1:24:29 PM

Hello,

What problem you r facing?..

Alternate links are here. ....

http://dotnetf1.blogspot.com/2008/07/convert-word-doc-into-pdf-using-c-code.html

Please let me know if you still face issues,

 


S.SRIRAM
1
s
11/11/2008 1:38:03 PM

Hi,

Based on my understanding, you should belong to these tools, Adobe Acrobat 7.0 Professional,postscript.exe,gs811w32.exe

Postscript.exe : it include the script for convertting.

Gs811w32.exe : The virtual machine work for printting

Actually. we can convert word document to pdf document by the script file of host

try to check the code as follows:

 

var files = WScript.Arguments;
var fso = new ActiveXObject("Scripting.FileSystemObject");
var word = new ActiveXObject("Word.Application");
var PDF = new ActiveXObject("PDFDistiller.PDFDistiller.1");
word.ActivePrinter = "MS Publisher Color Printer";

//files(0) the name of word
//files(1) the path after being converted
//files.length : the count of files need to convert
var docfile = files(0);
var psfile = files(1) + fso.GetBaseName(files(0)) + ".ps";
var pdffile = files(1) + fso.GetBaseName(files(0)) + ".pdf";
var logfile = files(1) + fso.GetBaseName(files(0)) + ".log";

try{
var doc = word.Documents.Open(docfile);
//WORD convert to PS
word.PrintOut(false, false, 0, psfile);
doc.Close(0);

//PS convert to PDF
PDF.FileToPDF(psfile,pdffile,"");

fso.GetFile(psfile).Delete();//Delete the script
fso.GetFile(logfile).Delete();//delete the log 
word.Quit();
WScript.Echo("isuccess");//successful
WScript.Quit(0);
}
catch(x)
 

Code :

 

public void StartConvertPDF()
{
 Process proc = new Process();
 proc.StartInfo.FileName = "cmd.exe";
 proc.StartInfo.WorkingDirectory = @"c:";
 proc.StartInfo.CreateNoWindow = true;
 proc.StartInfo.UseShellExecute = false;
 proc.StartInfo.RedirectStandardInput = true; //redirect
 proc.Start();
 proc.StandardInput.WriteLine(@"cscript //nologo c:ConvertDoc2PDF.js c:test.doc c:");
 proc.StandardInput.WriteLine("exit");
 proc.WaitForExit();
}
 

 

 

1
EmberLove
11/14/2008 7:17:27 AM
Hi,
try this product: Altsoft Xml2PDF (http://alt-soft.com)
1
Sinea
12/3/2008 4:57:01 PM
Reply:

Similar Artilces:

COnverting image file into PDF file in C#.NET
hi friends, i have a problem in creating a PDF file from an image file. first of all pls clarify what is the internal concept in converting to PDF file. if nay one knows pls mail me the related code if you find any solution pls mail me at spend5mins@yahoo.com thank u all hari babu...

How to File Upload and Download file ( .doc/.pdf/.gif/.exl) from server web browser C#
How to File Upload and Download file ( .doc/.pdf/.gif/.exl) from server web browser Please help me Thanking you Saikat   Uploading: Try a Google search for upload file web server asp.net c#. Download: <a href="http://www.mydomain.com/pathtofile">Download Me</a> HTH,RyanRyan OlshanASPInsider | Microsoft MVP, ASP.NEThttp://ryanolshan.comHow to ask a question HiI want to download this logo.gif . It is possable to download. Download: <a href="http://www.google.com/intl/en/images/logo.gif">Download Me</a> and How to File Upload .doc/.pdf/.gif/.exl file we...

How to convert .tiff image file to .pdf file without using any 3rd party tool using C#.net
HI allI have a urgent requirement i want to convert .tiff image to .pdf file Thanks in advance Regards RaviPlease click "mark as answer" if this post helped you. I dont think its possible without doing a lot of code or using third party tools, but if you  are looking for a free tool you can try a combination of http://blog.codebeach.com/2008/02/convert-multipage-tiff-to-pdf-in-net.htmland  http://www.codeproject.com/KB/aspnet/Creating_PDF_documents_in.aspx Thanks and RegardsS.K.Vignesh----------------------Do remember to "Mark as answer" for this pos...

How to convert a word .doc file into .tif file in c#?
Thank you for answer. this.brain=null;MSN+EMAIL: vincent90152900@gmail.com...

Convert Gridview Data in to PDf file. or Convert report data in pdf file
 Hi have problem to convert Gridview data into PDF file..let me know is there any solution or open source components..Regards Rambhopal Reddy EPlease remember to click “Mark as Answer” on the post that helps you, and to click “Unmark asAnswer” if a marked post does not actually answer your question. Friend, Check this thread for soultions http://forums.asp.net/t/1164793.aspx and then to http://www.aspnetworld.com/articles/2004011801.aspx   Good luck!     Please Don't forget to click "Mark as Answer" on the post that helped you.This can be benef...

Convert Word DOC File to Adobe Acrobat PDF file
Hello, Does anyone knows a component to convert an Word DOC File to Adobe Acrobat PDF file? I am creating a web site where people upload word  Word DOC files to the server. I need to convert the Word Doc files into PDF files as they are uploaded. Thanks, Miguel shapper--Regarding this... shapper wrote:...Does anyone knows a component to convert an Word DOC File to Adobe Acrobat PDF file?......I am creating a web site where people upload word  Word DOC files to the server. I need to convert the Word Doc files into PDF files as they are uploaded.......one should ...

web services used to convert Word files to PDF files
My professor asked me to design a web services which convert Microsoft's word files to PDF files. by use VS.NET and Windows Server 2003. After I installe Adode Acrobat 6.0 Professional, I can find some Acrobat components, Acrobat Distiller, Acrobat Web Capture 1.0 Type Library, etc. Please tell me which one can be used for my project and how to use it. Or please tell me popular free components of third parts. Thanks!...

PDF files and DOC files
Name: Jeff Kopacz Email: Jeffkopacz_at_mchsi.com Product: Firefox Summary: PDF files and DOC files Comments: When using Firefox and have to view a pdf file or Doc file I have to have Adobe Reader or Word started before selecting the file or the computer will lockup. I am using XP and Firefox 1.0.7. If I use either IE or Netscape they will open properly. This has recently occured with either version 6 or 7 Browser Details: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 ...

Problem with converting .doc file to .pdf file and also filling it with some details using iTextSharp
Hello Mate,                     I am having a problem in converting a .doc file in to .pdf file using iTextSharp.dll .And also i would like to wirte some details in to the form. the problem is the conversion of .doc to .pdf file is not working and also filling in to the converted .pdf file is also not working.Could you please tell me a solution?   This is my code  in this below method i am passing the full path of an existing .doc file public void Convert_And_Fill(string filepath...

converting html file to pdf file
is there anyway I can convert an html file to a pdf file ?HighOnCodingWanna get high! sure, either you use one time conversion using a program like Adobe Acrobat Professional or want to automate the creation of HTML files into pdf files frequently so you use a component plugged into your ASP.NET app see www.planetpdf.com for more infoThe best glimpse of heaven is on the way into hell ;)yousef.omar@gmail.comhttp://nonstopbiztalk.blogspot.com...

How to convert a PCL file into a PDF file?
How do I convert a PCL file into a PDF file for printing/saving purposes(possibly using Amyuni PDF converter)? Thank you! You would need a 3rd party tool. A search in Google found many results: http://www.google.ca/search?hl=en&q=pcl+to+pdf&btnG=Search&meta= Brad Alex wrote: > How do I convert a PCL file into a PDF file for > printing/saving purposes(possibly using Amyuni PDF > converter)? > > Thank you! ...

How to convert an RTF File to a PDF File?
Hello, I am using Powerbuilder 10.5.1 build 6565 and the following code to convert an RTF File to a PDF File. rte_1.SaveDocument("test.pdf", FileTypePDF!) But, it fails when I install my app on a different ws. What are the DLLs that I need to copy to the ws? Do I need to install Ghostscript or Adobe Writer? Thanks, Attilio Attilio, 10.5 has a new RichText control. It requires the files located in this directory: C:\Program Files\Sybase\Shared\PowerBuilder\rtc Roland <Attilio> wrote in message news:46681c94.6d4f.1681692777@sybase.com... > Hell...

I need a script that will allow someone to upload a .doc file, automatically convert and save the file to a pdf,bmp,png or other
I need a script that will allow someone to upload a .doc file, automatically convert and save the file to a pdf,bmp,png or other  or are there any programs that will monitor a directory (say checking every 10 minutes) to see if there are any doc files and then concert into pdf, html,bmp,etc... u could use threading...this is how it goes Step 1)in any application start function use Thread t = new Thread (Checkfile);t.Start();   Step 2)The function Checkfile static void Checkfile() {    while (true)    {      //CHE...

Convert Or Save Pdf file to html file
I want to convert or save pdf file to html programmatically through asp.net 1.1 & C#.Anyone knows solution please let me know coz I do a lot of search but didn't find any kind of solution.  Thanks & regards.   hi, check this link, http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/d835c1c9-0d04-4cb9-8d08-39e68ee911fd/...

Web resources about - convert .doc file to .pdf file in C# - asp.net.web-forms

List of converts to Buddhism - Wikipedia, the free encyclopedia
Ajahn Brahm (born 1951), Religious teacher and student of the late Thai monk Ajahn Chah . Currently he is the abbot of the Bodhinyana Monastery, ...

Facebook Timeline For Pages: 8 Million Converts, 29 Million To Go
... reach to 98 percent of users who liked its page, as well as to double its engagement rate, during a 28-day period. Dr. Pepper hasn’t yet converted ...

Facebook stock roundup: Execs offload more stock, directors convert shares
... Bowles, the former co-chair of the now-defunct National Commission on Fiscal Responsibility and Reform, and Reed Hastings, Netflix CEO, converted ...

How to Convert Leads Into Buying Customers - The 9 Step Sales Process EVERYONE Should Use
... School of Business in Toronto on the topics of Sales and Entrepreneurship. I shared with them the sales process that I find How to Convert Leads ...

Bitcoin : Should I convert my savings to Bitcoin?
Answer (1 of 7): You should think of this question as "Should I invest all my savings in Bitcoin?", and not "Should I have my savings denominated ...

Coordinates - Calculate and Convert a Position on the App Store on iTunes
Get Coordinates - Calculate and Convert a Position on the App Store. See screenshots and ratings, and read customer reviews.

Catholics should not convert Jews, says Vatican, in push against anti-Semitism
... 50 years since the Vatican's repudiation of the concept of Jewish guilt for Jesus' death.  Vatican City: Catholics should not try to convert ...

Today’s apps gone free: BlockBear, Stock Grader, PDF Smart Convert and more
Block ads and other annoying content, take the emotion out of investing, and convert almost anything into a PDF with todays collection of apps ...

Ford patents rear wheel that converts into a unicycle
Filed under: Government/Legal , Green , Ford , Green Driving , Motorcycle , Electric Ford is thinking about allowing drivers to remove a rear ...

How to convert your old VHS tapes to DVD with this software
Remember those old VHS tapes you have sitting in the corner? Convert them into DVDs with this affordable software so you can easily watch them ...

Resources last updated: 1/11/2016 7:47:34 PM