Copying file contents to clipboard and pasting into a plain text file automatically in python -


all trying accomplish little script wrote parse data pdf file.

however, seem have run issue python, more pypdf2 module not able read text pdf file. data printed out fuzzy , not readable. however, when open pdf file trying read can click drag , ctrl+c copy contents after when paste plain txt document works flawlessly. data readable when go through process of copying , pasting manually.

so i'm trying mimic exact step, automate instead of having me go through pages within pdf file performing above steps.

or if there suggestion else can achieve this, appreciate it. have tried converting pdf file docx , plain text files contents of file had formats re arranged

import pypdf2 pdffileobj = open('sjsuclassdata.pdf', 'rb') pdfreader = pypdf2.pdffilereader(pdffileobj) pdfreader.numpages  pageobj = pdfreader.getpage(4) print(pageobj.extracttext()) 

edit im trying write script perform following actions.

1.) read pdf file

2.) copy contents of whole page (ctrl+a)

3.) paste contents of whole page plain text file (ctrl+v)

4.) read pdf till end of file

i give slate try:

import slate  output_prefix = 'foobar' file_ext = 'txt'  open('example.pdf') f:         doc = slate.pdf(f)         page_number, page in enumerate(doc):             open('%s_%s.%s' % (output_suffix, page_number, file_ext), 'w+').write(doc[page_number]) 

Comments

Popular posts from this blog

sql server - Cannot query correctly (MSSQL - PHP - JSON) -

php - trouble displaying mysqli database results in correct order -

C++ Linked List -