Converting Word File To PDF without using Word Application Scope

Hi, is there any way to convert Word File to PDF file without using Word Application scope? “Invoke code” can solve this but I want to reduce the runtime even more. Is there any solution to make the automation even faster with “Invoke Code” activity to convert Word File to PDF?

P.S. I need to convert about 20k word files.

Here’s the example code,

Dim App As New Microsoft.Office.Interop.Word.Application
App.Visible = False
Dim doc As String
For Each doc In System.IO.Directory.GetFiles(InputFolder,“*.docx”)
console.WriteLine(doc)
Dim MyDoc As Microsoft.Office.Interop.Word.Document = MyApp.Documents.Open(doc.ToString)
Mydoc.SaveAs(doc.Replace(“.docx”,“.pdf”), Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF)
Mydoc.Close(Microsoft.Office.Interop.Word.WdSaveOptions.wdDoNotSaveChanges)
Next
MyApp.Quit()

Hi @chilled_lad

You could use blow custom package

1 Like

Hi @chilled_lad ,
Only those two option is there to convert word to pdf.

you can create custom activity also but again the same code you are going to use to convert the word to pdf file.

Regards,
Arivu

1 Like

Thanks, I’ll try this.

Since it’s the same code I’m using, the runtime can’t be faster , right?

yes it will be the same, depends on file size it will take an time.

Thanks for your time and effort! @arivu96

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.