From 0ab79f0ab6cdc0850a0ea0c9c667282ce5b3b639 Mon Sep 17 00:00:00 2001 From: Martin Thoma Date: Mon, 24 Aug 2020 10:09:08 +0200 Subject: [PATCH] DOC: Make README, Github page and PyPI page show the same information Also mark the project as inactive --- README | 38 ------------------------------------- README.md | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ setup.cfg | 3 +++ setup.py | 20 ++------------------ 4 files changed, 61 insertions(+), 56 deletions(-) delete mode 100644 README create mode 100644 README.md create mode 100644 setup.cfg diff --git a/README b/README deleted file mode 100644 index 3d7947a..0000000 --- a/README +++ /dev/null @@ -1,38 +0,0 @@ -Example: - - from pyPdf import PdfFileWriter, PdfFileReader - - output = PdfFileWriter() - input1 = PdfFileReader(file("document1.pdf", "rb")) - - # add page 1 from input1 to output document, unchanged - output.addPage(input1.getPage(0)) - - # add page 2 from input1, but rotated clockwise 90 degrees - output.addPage(input1.getPage(1).rotateClockwise(90)) - - # add page 3 from input1, rotated the other way: - output.addPage(input1.getPage(2).rotateCounterClockwise(90)) - # alt: output.addPage(input1.getPage(2).rotateClockwise(270)) - - # add page 4 from input1, but first add a watermark from another pdf: - page4 = input1.getPage(3) - watermark = PdfFileReader(file("watermark.pdf", "rb")) - page4.mergePage(watermark.getPage(0)) - - # add page 5 from input1, but crop it to half size: - page5 = input1.getPage(4) - page5.mediaBox.upperRight = ( - page5.mediaBox.getUpperRight_x() / 2, - page5.mediaBox.getUpperRight_y() / 2 - ) - output.addPage(page5) - - # print how many pages input1 has: - print "document1.pdf has %s pages." % input1.getNumPages()) - - # finally, write "output" to document-output.pdf - outputStream = file("document-output.pdf", "wb") - output.write(outputStream) - - diff --git a/README.md b/README.md new file mode 100644 index 0000000..a65ee68 --- /dev/null +++ b/README.md @@ -0,0 +1,56 @@ +A Pure-Python library built as a PDF toolkit. It is capable of: + +- extracting document information (title, author, ...), +- splitting documents page by page, +- merging documents page by page, +- cropping pages, +- merging multiple pages into a single page, +- encrypting and decrypting PDF files. + +By being Pure-Python, it should run on any Python platform without any +dependencies on external libraries. It can also work entirely on StringIO +objects rather than file streams, allowing for PDF manipulation in memory. +It is therefore a useful tool for websites that manage or manipulate PDFs. + +## Note + +This project is no longer updated. I've stopped maintaining pyPdf, and a company named Phaseit has forked the project and continued development and maintenance with my blessing as [pyPdf2](https://github.com/mstamy2/pypdf2). + +## Example + +```python +from pyPdf import PdfFileWriter, PdfFileReader + +output = PdfFileWriter() +input1 = PdfFileReader(file("document1.pdf", "rb")) + +# add page 1 from input1 to output document, unchanged +output.addPage(input1.getPage(0)) + +# add page 2 from input1, but rotated clockwise 90 degrees +output.addPage(input1.getPage(1).rotateClockwise(90)) + +# add page 3 from input1, rotated the other way: +output.addPage(input1.getPage(2).rotateCounterClockwise(90)) +# alt: output.addPage(input1.getPage(2).rotateClockwise(270)) + +# add page 4 from input1, but first add a watermark from another pdf: +page4 = input1.getPage(3) +watermark = PdfFileReader(file("watermark.pdf", "rb")) +page4.mergePage(watermark.getPage(0)) + +# add page 5 from input1, but crop it to half size: +page5 = input1.getPage(4) +page5.mediaBox.upperRight = ( + page5.mediaBox.getUpperRight_x() / 2, + page5.mediaBox.getUpperRight_y() / 2 +) +output.addPage(page5) + +# print how many pages input1 has: +print "document1.pdf has %s pages." % input1.getNumPages()) + +# finally, write "output" to document-output.pdf +outputStream = file("document-output.pdf", "wb") +output.write(outputStream) +``` diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..ed1700c --- /dev/null +++ b/setup.cfg @@ -0,0 +1,3 @@ +[metadata] +long_description = file: README.md +long_description_content_type = text/markdown diff --git a/setup.py b/setup.py index 291bfe7..d1afbd0 100755 --- a/setup.py +++ b/setup.py @@ -2,33 +2,17 @@ from distutils.core import setup -long_description = """ -A Pure-Python library built as a PDF toolkit. It is capable of: - -- extracting document information (title, author, ...), -- splitting documents page by page, -- merging documents page by page, -- cropping pages, -- merging multiple pages into a single page, -- encrypting and decrypting PDF files. - -By being Pure-Python, it should run on any Python platform without any -dependencies on external libraries. It can also work entirely on StringIO -objects rather than file streams, allowing for PDF manipulation in memory. -It is therefore a useful tool for websites that manage or manipulate PDFs. -""" setup( name="pyPdf", - version="1.12", + version="1.13", description="PDF toolkit", - long_description=long_description, author="Mathieu Fenniak", author_email="biziqe@mathieu.fenniak.net", url="http://pybrary.net/pyPdf/", download_url="http://pybrary.net/pyPdf/pyPdf-1.12.tar.gz", classifiers = [ - "Development Status :: 5 - Production/Stable", + "Development Status :: 7 - Inactive", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Programming Language :: Python",