Long pdf file to word conversion

Hi @maneesha.padamata

Try this way:
=> Use Read PDF with OCR activity and save the output to a variable say pdfTextVariable

=>Use the below code in Invoke Code activity. Change the path where you want to store the word document in 10th line.

' Initialize Word application
Dim wordApp As New Microsoft.Office.Interop.Word.Application()

' Create a new document
Dim doc As Microsoft.Office.Interop.Word.Document = wordApp.Documents.Add()

' Get PDF text from UiPath variable (pdfTextVariable)
Dim pdfText As String = pdfTextVariable

' Paste the text into Word document
doc.Content.Text = pdfText

' Save the Word document to a desired location
doc.SaveAs("C:\Users\"+Environment.UserName+"\Documents\UiPath\Beginners Learning Challenge 3 PDF automation\Output.docx")

' Close Word application and clean up
doc.Close()
wordApp.Quit()

Invoked Arguments:

Hope it helps!!

1 Like