I'm just trying to read mail attachment (PDF file attached) in memory so that i can use that it for pyPdf2
Here is the basic code,
from pyPdf2 import PdfFileReader
.
.
for attachment in message.attachments:
attachment_name = attachment[0].decode()
attachment_content = attachment[1].decode()
Here i just wanted to know that how much pages (page count) attached pdf has using attachment_content
& attachment_name
variable,
For more info, There is a method in pyPdf2
, using that we can get pages count.
pdf_instance = PdfFileReader(file(file_path, "rb")) #But i'm stuck here, how to specify here *file_path* & not able to use that *attachment_content* & *attachment_name* varible
pdf_instance.getNumPages()
Any body can help me out here to use PdfFileReader
Thanks.
Niks