I would like to know if it is possible to convert all doc and docx files (don’t know names) from one folder and transfer them to the other folder as a PDF format. Not one PDF but multiple PDFs. One doc = one PDF and so on.
I was trying the following code. But I get error: "DirectoryNotFoundException was unhandled"
Also, I’m not sure how to to convert doc and docx or even rtf files to pdf.
I used the following code:
static void Main(string args)
string dir = @“C:\Source”;
string des = @“C:\Destination”;
string txts = Directory.GetFiles(dir, “*.rtf”);
foreach (string fileName in txts)
Document txt = new Document(fileName);
Also sometimes I need to change the name of the file (Optional feature).
Thank you for any help.
Thanks for your inquiry. The DirectoryNotFoundException is thrown when part of a file or directory cannot be found. Please make sure that you are using the correct path.
You can convert Doc, Docx, Rtf, Html
etc files to Pdf file format by using Aspose.Words. You can load file
formats mentioned at following documentation link into Aspose.Words DOM.
Once you have loaded a file of LoadFormat into Aspose.Words DOM, you can easily render it to Pdf. I would suggest you please read the following article for more details: