How to read pdf using python?

here i am trying to read pdf using PyPDF2 .


getting error

Code:
set code to ‘’’
import PyPDF2

pdfFileObj = open(r’C:\Users\DALVRU-CONT\Downloads\sample.pdf’, ‘rb’)

pdfReader = PyPDF2.PdfFileReader(pdfFileObj)

print(pdfReader.numPages)

pageObj = pdfReader.getPage(0)

print(pageObj.extractText())’’’
set path to “C:\Users\DALVRU-CONT\AppData\Local\Programs\Python\Python38-32\Lib\site-packages”

System.RunPython PythonCode:code ModuleFolderPaths:path ScriptOutput=> ScriptOutput ScriptError=> ScriptError
Console.Write Message:ScriptError + ScriptOutput

Robin uses the IronPython implementation of Python and thus only compatible modules can be imported.
Instead of using the RunPython module, perhaps you could check out the following guide that @burque505 has prepared: Intro guide: Extract AcroForm PDF data with Python and Robin

4 Likes

We can run python code by Run Dos Coomand.

code:
System.RunDOSCommand DOSCommandOrApplication:“C:\Users\user\AppData\Local\Programs\Python\Python38-32\pdf2.py” WorkingDirectory:’’ StandardOutput=> StandardOutput StandardError=> StandardError ExitCode=> ExitCode
Console.Write Message: StandardOutput

1 Like