

import base64
import os

base64_bytes = 'MEUCIAfMRvXbONh32lUBAq5CJRLk2+gDVOlL4cb5yVoZgfIjAiEAmTWQ1XZFspKdee0iiXYg4KQZZbBuFcCa3uJiMdGzKfM='

# image_bytes = base64.b64decode(base64_bytes)
# print(str(image_bytes,"GB18030"))
# image_path = os.path.join("","swf_page_%d.png"%(1))
# with open(image_path, 'wb') as f:
#     f.write(image_bytes)

# import keras
# from io import BytesIO
# s = BytesIO()
# s.write(b'adfdafa')
# s.seek(0,2)
# a = s.tell()
# print(a)

from PyPDF2 import PdfFileReader, PdfFileWriter
from pdfminer.pdfparser import PDFParser
from pdfminer.pdfdocument import PDFDocument
from pdfminer.pdfpage import PDFPage
from pdfminer.pdfinterp import PDFResourceManager, PDFPageInterpreter
from pdfminer.converter import PDFPageAggregator
from pdfminer.layout import LTTextBoxHorizontal, LAParams, LTFigure, LTImage, LTCurve, LTText, LTChar, LTRect, \
    LTTextBoxVertical, LTLine
from io import BytesIO
_b = open("4f70ff9e095cd8fe0651a694a1976ebe.pdf","rb").read()
bio = BytesIO()
bio.write(_b)

def generateFp(_bytes):
    bio = BytesIO()
    bio.write(_bytes)
    return bio

parser = PDFParser(bio)
doc_pdfminer = PDFDocument(parser)
rsrcmgr = PDFResourceManager()
laparams = LAParams(line_overlap=0.01,
                         char_margin=0.05,
                         line_margin=0.01,
                         word_margin=0.01,
                         boxes_flow=0.1,)
device = PDFPageAggregator(rsrcmgr, laparams=laparams)
interpreter = PDFPageInterpreter(rsrcmgr, device)

pages = PDFPage.create_pages(doc_pdfminer)
pages = list(pages)
page_count = len(pages)
page_no = 0
for page in pages:
    print(1)