pypdf2

NotImplementedError: only algorithm code 1 and 2 are supported in PyPDF2

ε祈祈猫儿з 提交于 2021-02-10 15:44:16
问题 I have been creating a program in Python for merging 2 pdf files into a single file. Here is the code:- import os from PyPDF2 import PdfFileMerger source_dir = os.getcwd() merger = PdfFileMerger() for item in os.listdir(source_dir): if item.endswith('pdf'): merger.append(item) merger.write('completed_file.pdf') merger.close() while running the code i encountered the following error:- "F:\Python folder\Pdf_Merger\venv\Scripts\python.exe" "F:/Python folder/Pdf_Merger/main.py" Traceback (most

EOF marker not found while use PyPDF2 merge pdf file in python

橙三吉。 提交于 2021-02-08 13:15:17
问题 When I use the following code from PyPDF2 import PdfFileMerger merge = PdfFileMerger() for newFile in nlst: merge.append(newFile) merge.write('newFile.pdf') Something happened as following: raise utils.PdfReadError("EOF marker not found") PyPDF2.utils.PdfReadError: EOF marker not found Anybody could tell me what happened? Thanks 回答1: PDF is a file format, where a pdf parser normally starts reading the file by reading some global information located at the end of the file. At the very end of

EOF marker not found while use PyPDF2 merge pdf file in python

拈花ヽ惹草 提交于 2021-02-08 13:14:28
问题 When I use the following code from PyPDF2 import PdfFileMerger merge = PdfFileMerger() for newFile in nlst: merge.append(newFile) merge.write('newFile.pdf') Something happened as following: raise utils.PdfReadError("EOF marker not found") PyPDF2.utils.PdfReadError: EOF marker not found Anybody could tell me what happened? Thanks 回答1: PDF is a file format, where a pdf parser normally starts reading the file by reading some global information located at the end of the file. At the very end of

How to use AWS lambda to convert pdf files to .txt with python

只愿长相守 提交于 2021-01-29 09:57:46
问题 I need to automate the conversion of many pdf to text files using AWS lambda in python 3.7 I've successfully converted pdf files using poppler/pdftotext, tika, and PyPDF2 on my own machine. However tika times out or needs to run a java instance on a host machine which I'm not sure how to set up. pdftotext needs poppler and all the solutions for running that on lambda seems to be outdated or I'm just not familiar enough with binarys to make sense of that solution. PyPDF2 seems the most

How do I know my file is attached in my PDF using PyPDF2?

给你一囗甜甜゛ 提交于 2021-01-28 11:10:57
问题 I am trying to attach an .exe file into a PDF using PyPDF2. I ran the code. It runs flawlessly, but my PDF file is still the same size. I don't know if my file was attached or not. This is what I am trying to do: from PyPDF2 import PdfFileWriter, PdfFileReader output = PdfFileWriter() input1 = PdfFileReader(open ("doc1.pdf", "rb")) #check it's whether work or not print("doc1 has %d pages" % input1.getNumPages()) output.addAttachment("doc1.pdf","client.exe") I don't know if I am doing this

How do I know my file is attached in my PDF using PyPDF2?

Deadly 提交于 2021-01-28 11:04:52
问题 I am trying to attach an .exe file into a PDF using PyPDF2. I ran the code. It runs flawlessly, but my PDF file is still the same size. I don't know if my file was attached or not. This is what I am trying to do: from PyPDF2 import PdfFileWriter, PdfFileReader output = PdfFileWriter() input1 = PdfFileReader(open ("doc1.pdf", "rb")) #check it's whether work or not print("doc1 has %d pages" % input1.getNumPages()) output.addAttachment("doc1.pdf","client.exe") I don't know if I am doing this