diff --git a/PyPDF4/generic.py b/PyPDF4/generic.py index 959957d..8d6fb15 100644 --- a/PyPDF4/generic.py +++ b/PyPDF4/generic.py @@ -853,13 +853,13 @@ class EncodedStreamObject(StreamObject): class RectangleObject(ArrayObject): """ - This class is used to represent *page boxes* in PyPDF2. These boxes include: + This class is used to represent *page boxes* in PyPDF4. These boxes include: - * :attr:`artBox ` - * :attr:`bleedBox ` - * :attr:`cropBox ` - * :attr:`mediaBox ` - * :attr:`trimBox ` + * :attr:`artBox ` + * :attr:`bleedBox ` + * :attr:`cropBox ` + * :attr:`mediaBox ` + * :attr:`trimBox ` """ def __init__(self, arr): # must have four points @@ -954,7 +954,7 @@ class RectangleObject(ArrayObject): class Field(TreeObject): """ A class representing a field dictionary. This class is accessed through - :meth:`getFields()` + :meth:`getFields()` """ def __init__(self, data): DictionaryObject.__init__(self) @@ -994,8 +994,8 @@ class Field(TreeObject): mappingName = property(lambda self: self.get("/TM")) """ Read-only property accessing the mapping name of this field. This - name is used by PyPDF2 as a key in the dictionary returned by - :meth:`getFields()` + name is used by PyPDF4 as a key in the dictionary returned by + :meth:`getFields()` """ flags = property(lambda self: self.get("/Ff")) diff --git a/PyPDF4/pagerange.py b/PyPDF4/pagerange.py index ce96ec5..b3d410f 100644 --- a/PyPDF4/pagerange.py +++ b/PyPDF4/pagerange.py @@ -4,7 +4,7 @@ Representation and utils for ranges of PDF file pages. Copyright (c) 2014, Steve Witham . All rights reserved. This software is available under a BSD license; -see https://github.com/mstamy2/PyPDF2/blob/master/LICENSE +see https://github.com/claird/PyPDF4/blob/master/LICENSE """ import re diff --git a/PyPDF4/pdf.py b/PyPDF4/pdf.py index c5cae9e..8bfd312 100644 --- a/PyPDF4/pdf.py +++ b/PyPDF4/pdf.py @@ -40,7 +40,7 @@ __author__ = "Mathieu Fenniak" __author_email__ = "biziqe@mathieu.fenniak.net" __maintainer__ = "Phaseit, Inc." -__maintainer_email = "PyPDF2@phaseit.net" +__maintainer_email = "PyPDF4@phaseit.net" import string import math @@ -97,7 +97,7 @@ class PdfFileWriter(object): # info object info = DictionaryObject() info.update({ - NameObject("/Producer"): createStringObject(codecs.BOM_UTF16_BE + u_("PyPDF2").encode('utf-16be')) + NameObject("/Producer"): createStringObject(codecs.BOM_UTF16_BE + u_("PyPDF4").encode('utf-16be')) }) self._info = self._addObject(info) @@ -133,7 +133,7 @@ class PdfFileWriter(object): :class:`PdfFileReader` instance. :param PageObject page: The page to add to the document. Should be - an instance of :class:`PageObject` + an instance of :class:`PageObject` """ self._addPage(page, list.append) @@ -179,7 +179,7 @@ class PdfFileWriter(object): :param float height: The height of the new page expressed in default user space units. :return: the newly appended page - :rtype: :class:`PageObject` + :rtype: :class:`PageObject` :raises PageSizeNotDefinedError: if width and height are not defined and previous page does not exist. """ @@ -198,7 +198,7 @@ class PdfFileWriter(object): user space units. :param int index: Position to add the page. :return: the newly appended page - :rtype: :class:`PageObject` + :rtype: :class:`PageObject` :raises PageSizeNotDefinedError: if width and height are not defined and previous page does not exist. """ @@ -903,7 +903,7 @@ class PdfFileWriter(object): :param int pagenum: index of the page on which to place the URI action. :param int uri: string -- uri of resource to link to. - :param rect: :class:`RectangleObject` or array of four + :param rect: :class:`RectangleObject` or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]``, or string in the form ``"[ xLL yLL xUR yUR ]"``. :param border: if provided, an array describing border-drawing @@ -960,7 +960,7 @@ class PdfFileWriter(object): :param int pagenum: index of the page on which to place the link. :param int pagedest: index of the page to which the link should go. - :param rect: :class:`RectangleObject` or array of four + :param rect: :class:`RectangleObject` or array of four integers specifying the clickable rectangular area ``[xLL, yLL, xUR, yUR]``, or string in the form ``"[ xLL yLL xUR yUR ]"``. :param border: if provided, an array describing border-drawing @@ -1258,7 +1258,7 @@ class PdfFileReader(object): :param fileobj: A file object (usually a text file) to write a report to on all interactive form fields found. :return: A dictionary where each key is a field name, and each - value is a :class:`Field` object. By + value is a :class:`Field` object. By default, the mapping name is used for keys. :rtype: dict, or ``None`` if form data could not be located. """ @@ -1352,7 +1352,7 @@ class PdfFileReader(object): Retrieves the named destinations present in the document. :return: a dictionary which maps names to - :class:`Destinations`. + :class:`Destinations`. :rtype: dict """ if retval == None: @@ -1398,7 +1398,7 @@ class PdfFileReader(object): """ Retrieves the document outline present in the document. - :return: a nested list of :class:`Destinations`. + :return: a nested list of :class:`Destinations`. """ if outlines == None: outlines = [] @@ -1461,7 +1461,7 @@ class PdfFileReader(object): Retrieve page number of a given PageObject :param PageObject page: The page to get page number. Should be - an instance of :class:`PageObject` + an instance of :class:`PageObject` :return: the page number or -1 if page not found :rtype: int """ @@ -1475,7 +1475,7 @@ class PdfFileReader(object): :param Destination destination: The destination to get page number. Should be an instance of - :class:`Destination` + :class:`Destination` :return: the page number or -1 if page not found :rtype: int """ @@ -2155,8 +2155,8 @@ class PageObject(DictionaryObject): """ This class represents a single page within a PDF file. Typically this object will be created by accessing the - :meth:`getPage()` method of the - :class:`PdfFileReader` class, but it is + :meth:`getPage()` method of the + :class:`PdfFileReader` class, but it is also possible to create an empty page with the :meth:`createBlankPage()` static method. @@ -2689,14 +2689,14 @@ class PageObject(DictionaryObject): mediaBox = createRectangleAccessor("/MediaBox", ()) """ - A :class:`RectangleObject`, expressed in default user space units, + A :class:`RectangleObject`, expressed in default user space units, defining the boundaries of the physical medium on which the page is intended to be displayed or printed. """ cropBox = createRectangleAccessor("/CropBox", ("/MediaBox",)) """ - A :class:`RectangleObject`, expressed in default user space units, + A :class:`RectangleObject`, expressed in default user space units, defining the visible region of default user space. When the page is displayed or printed, its contents are to be clipped (cropped) to this rectangle and then imposed on the output medium in some @@ -2705,20 +2705,20 @@ class PageObject(DictionaryObject): bleedBox = createRectangleAccessor("/BleedBox", ("/CropBox", "/MediaBox")) """ - A :class:`RectangleObject`, expressed in default user space units, + A :class:`RectangleObject`, expressed in default user space units, defining the region to which the contents of the page should be clipped when output in a production enviroment. """ trimBox = createRectangleAccessor("/TrimBox", ("/CropBox", "/MediaBox")) """ - A :class:`RectangleObject`, expressed in default user space units, + A :class:`RectangleObject`, expressed in default user space units, defining the intended dimensions of the finished page after trimming. """ artBox = createRectangleAccessor("/ArtBox", ("/CropBox", "/MediaBox")) """ - A :class:`RectangleObject`, expressed in default user space units, + A :class:`RectangleObject`, expressed in default user space units, defining the extent of the page's meaningful content as intended by the page's creator. """ @@ -2849,13 +2849,13 @@ class DocumentInformation(DictionaryObject): """ A class representing the basic document metadata provided in a PDF File. This class is accessible through - :meth:`getDocumentInfo()` + :meth:`getDocumentInfo()` All text properties of the document metadata have *two* properties, eg. author and author_raw. The non-raw property will always return a ``TextStringObject``, making it ideal for a case where the metadata is being displayed. The raw property can sometimes return - a ``ByteStringObject``, if PyPDF2 was unable to decode the string's + a ``ByteStringObject``, if PyPDF4 was unable to decode the string's text encoding; this requires additional safety in the caller and therefore is not as commonly accessed. """ diff --git a/PyPDF4/utils.py b/PyPDF4/utils.py index 2120c70..5378a99 100644 --- a/PyPDF4/utils.py +++ b/PyPDF4/utils.py @@ -194,7 +194,7 @@ def markLocation(stream): # Mainly for debugging RADIUS = 5000 stream.seek(-RADIUS, 1) - outputDoc = open('PyPDF2_pdfLocation.txt', 'w') + outputDoc = open('PyPDF4_pdfLocation.txt', 'w') outputDoc.write(stream.read(RADIUS)) outputDoc.write('HERE') outputDoc.write(stream.read(RADIUS)) diff --git a/PyPDF4/xmp.py b/PyPDF4/xmp.py index 7ba62f0..7e4374c 100644 --- a/PyPDF4/xmp.py +++ b/PyPDF4/xmp.py @@ -54,7 +54,7 @@ iso8601 = re.compile(""" class XmpInformation(PdfObject): """ An object that represents Adobe XMP metadata. - Usually accessed by :meth:`getXmpMetadata()` + Usually accessed by :meth:`getXmpMetadata()` """ def __init__(self, stream): diff --git a/Scripts/2-up.py b/Scripts/2-up.py index 41e2b2a..9a2668f 100644 --- a/Scripts/2-up.py +++ b/Scripts/2-up.py @@ -1,4 +1,4 @@ -from PyPDF2 import PdfFileWriter, PdfFileReader +from PyPDF4 import PdfFileWriter, PdfFileReader import sys import math @@ -25,7 +25,7 @@ def main(): if __name__ == "__main__": main() -from PyPDF2 import PdfFileWriter, PdfFileReader +from PyPDF4 import PdfFileWriter, PdfFileReader import sys import math diff --git a/Scripts/pdf-image-extractor.py b/Scripts/pdf-image-extractor.py index 601309c..fbbda08 100644 --- a/Scripts/pdf-image-extractor.py +++ b/Scripts/pdf-image-extractor.py @@ -6,7 +6,7 @@ http://stackoverflow.com/questions/2693820/extract-images-from-pdf-without-resam ''' import sys -import PyPDF2 +import PyPDF4 from PIL import Image if (len(sys.argv) != 2): @@ -16,7 +16,7 @@ if (len(sys.argv) != 2): pdf = sys.argv[1] if __name__ == '__main__': - input1 = PyPDF2.PdfFileReader(open(pdf, "rb")) + input1 = PyPDF4.PdfFileReader(open(pdf, "rb")) page0 = input1.getPage(30) if '/XObject' in page0['/Resources']: diff --git a/Tests/tests.py b/Tests/tests.py index 0e59af1..27cce65 100644 --- a/Tests/tests.py +++ b/Tests/tests.py @@ -3,7 +3,7 @@ import sys import unittest import binascii -from PyPDF2 import PdfFileReader, PdfFileWriter +from PyPDF4 import PdfFileReader, PdfFileWriter # Configure path environment diff --git a/setup.py b/setup.py index 9e16ec8..61887d9 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ objects rather than file streams, allowing for PDF manipulation in memory. It is therefore a useful tool for websites that manage or manipulate PDFs. """ -VERSIONFILE="PyPDF2/_version.py" +VERSIONFILE="PyPDF4/_version.py" verstrline = open(VERSIONFILE, "rt").read() VSRE = r"^__version__ = ['\"]([^'\"]*)['\"]" mo = re.search(VSRE, verstrline, re.M) @@ -30,15 +30,15 @@ else: raise RuntimeError("Unable to find version string in %s." % (VERSIONFILE)) setup( - name="PyPDF2", + name="PyPDF4", version=verstr, description="PDF toolkit", long_description=long_description, author="Mathieu Fenniak", author_email="biziqe@mathieu.fenniak.net", maintainer="Phaseit, Inc.", - maintainer_email="PyPDF2@phaseit.net", - url="http://mstamy2.github.com/PyPDF2", + maintainer_email="PyPDF4@phaseit.net", + url="http://claird.github.com/PyPDF4", classifiers = [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", @@ -48,5 +48,5 @@ setup( "Operating System :: OS Independent", "Topic :: Software Development :: Libraries :: Python Modules", ], - packages=["PyPDF2"], + packages=["PyPDF4"], )