File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ # PDF Page Extractor
2+ This is a simple script that lets you extract a single page from a pdf.
3+
4+ Usage
5+ Clone the repo
6+ download the requirements
7+ run python script.py
Original file line number Diff line number Diff line change 1+ import PyPDF2
2+ file = input ("Name of your pdf file you want to extract a page from: " )
3+ pdfFileObj = open (file + '.pdf' , 'rb' )
4+ pdfReader = PyPDF2 .PdfFileReader (pdfFileObj )
5+ pgnumber = input ("Which page would you like to extract?: " )
6+ pageObj = pdfReader .getPage (int (pgnumber ) - 1 )
7+ pdfWriter = PyPDF2 .PdfFileWriter ()
8+ pdfWriter .addPage (pageObj )
9+ outputfile = input ("Name new pdf file: " )
10+ pdfOutputFile = open (outputfile + '.pdf' , 'wb' )
11+ pdfWriter .write (pdfOutputFile )
12+ pdfOutputFile .close ()
You can’t perform that action at this time.
0 commit comments