Open File in PyMuPdf via a POST data

17 views Asked by At

I want to test PyMuPdf against pdfplumber.

In pdfplumber I use this - works fine.

file = request.FILES.get('file') 

with pdfplumber.open(file) as pdf:

    for pg, element in enumerate(pdf.pages):

        current_page = pdf.pages[pg]

When I try to open the same file with PyMuPdf I get this.

doc = fitz.open(file)

'fitz.FileNotFoundError: no such file: 'testpages.pdf'

This is my POST data.

print(request.FILES)

<MultiValueDict: {'file': [<InMemoryUploadedFile:testpages.pdf (application/pdf)>]}>

Not sure what the difference is? Thank you so much.

0

There are 0 answers