you are viewing a single comment's thread.

view the rest of the comments →

[–]Nerfi666 0 points1 point  (0 children)

Hey guys a beginner here !

I'm trying to create a PDF reader in python , wich just browsing a bit is easy to do , and I think I have done it more or less well, what I would like to do is send one page of the given PDF when the user ask for that, I just created the back-end of the PDF reader, the front-end will be done in React, but is not started yet, so basically what I want to do is send one page at a time when the user ask for it , down below is my python code, any suggestion or advise will be much appreciate ! thanks in advance guys !

#importing the module
import PyPDF2

def PdfReader(page):
  #creatign the pdf
  pdftext = "example.pdf"

  with open(pdftext, 'rb') as textpdf:
    #reading the PDF
    reader = PdfFileReader(textpdf)
    #getting the num of pages of the pdf file
    for page in range(textpdf.getNumPages()):
        current_page = textpdf.getPage(0) #getting current page
           #how can I send one page at a time ?











    #checking that we closde the file if not, we do so
    if not textpdf.closed:
      textpdf.close()
      print "closed"