Hi, i want to convert a long pdf file of 100 pages to word doc. i am facing issue my bot is converting only 18 pages and ending the exceution without any error. please help me in resolving it .
Welcome to the UiPath Community!
You can follow this approach.
- Get the count of pages in the PDF file into a variable.
Get PDF Page Count - Use For Each activity to loop all the pages. Declare Index variable to store each iterating page number.
- Use Read PDF With OCR inside the For Each loop and set the Range Property to
indexVariable +1
this will ensure the page number start with 1 - Add your additional logic to add it to Word file and all.
Thanks,
Ashok
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!!
Your insight and expertise have been immensely helpful in resolving the my issue. Thank you so much @Parvathy
thank you for your support
You can try this below link
Approach 1
Approach 2 - Other nuget Pakages
Hope your query is resolved. If yes, please mark my post as solution to close the loop or if you have any queries I’m happy to help.
Regards
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.