Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: py-pdf/pypdf
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.12.1
Choose a base ref
...
head repository: py-pdf/pypdf
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3.0.0
Choose a head ref
  • 14 commits
  • 36 files changed
  • 5 contributors

Commits on Dec 10, 2022

  1. MAINT: Refactor Fit / Zoom parameters (#1437)

    Introduce a new `PyPDF2.generic.Fit` class which captures the type and parameter for how a page should be fit in the viewer (e.g. when clicking on a PDF-internal link).
    
    The class has one method for each fit type which allows users to discover the different types via their IDE, e.g. `Fit.xyz(left=123, top=456, zoom=2)`.
    
    ## Breaking Change
    
    This **introduces a breaking change** that needs a major version bump. Affected are the following methods:
    
    * `PdfMerger.add_outline_item` used `fit: FitType` and `*args: ZoomArgType` parameters
    * `PdfWriter.add_outline_item` used `fit: FitType` and `*args: ZoomArgType` parameters
    * `AnnotationBuilder.link`  used `fit: FitType = "/Fit"` and `fit_args: Tuple[ZoomArgType, ...] = tuple()` instead.
    
    Instead of having two arguments, we now have only one. To that argument, an object of the new `Fit` class must be passed.
    
    ## Why *args is problematic
    
    Using the `*args` pattern is problematic for two reasons:
    
    * **User-code readability**:
      * People cannot use the more expressive keyword-argument syntax in their code for the non-fit parameters
      * People may or may not use the keyword-parameter for the fit parameters
    * **Library extensions**: PyPDF2 cannot easily add new parameter to those functions; #1371 is the latest PR that stumbled over this issue
    * **Two parameter for one thing**: In general I don't like if we have two parameters for one topic
    MartinThoma authored Dec 10, 2022
    Configuration menu
    Copy the full SHA
    7633477 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    437aec9 View commit details
    Browse the repository at this point in the history

Commits on Dec 11, 2022

  1. ENH: Allow int for indirect_reference in PdfWriter.get_object (#1490)

    Co-authored-by: pubpub-zz <4083478+pubpub-zz@users.noreply.github.com>
    MartinThoma and pubpub-zz authored Dec 11, 2022
    Configuration menu
    Copy the full SHA
    2aba718 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9674f5f View commit details
    Browse the repository at this point in the history
  3. ENH: Add Cloning (#1371)

    The method `.clone(pdf_dest,[force_duplicate])` clones the objects and all referenced objects.
    
    If an object is already cloned, the already cloned object is returned (unless force_duplicate is set)
    mainly for internal use but can be used on a page
    for pageObject/DictionnaryObject/[Encoded/Decoded/Content]Stream an extra parameter ignore_fields list that provide the list of fields that should not be cloned.
    
    When available, the pointer to an object is available in `indirect_obj` attribute.
    
    New API for add_page/insert_page that :
    
    * returns the cloned page object
    * ignore_fields can be provided as a parameter.
    
    ## Others
    
    * file is closed at the end of PdfWriter.write when a filename is provided
    * Breaking Change: `add_outline_item` now has a parameter before which is not the last parameter
    
    ## Update
    * The public API of PdfMerger has been added to PdfWriter (ready to make PdfMerger an alias of it)
    * Process properly Outline merging
    * Process properly Named destinated
    
    Deals with #1194, #1322, #471, #1337
    pubpub-zz authored Dec 11, 2022
    Configuration menu
    Copy the full SHA
    74b8a63 View commit details
    Browse the repository at this point in the history

Commits on Dec 12, 2022

  1. Configuration menu
    Copy the full SHA
    690247a View commit details
    Browse the repository at this point in the history

Commits on Dec 13, 2022

  1. DOC: Add Olson Perrensen

    MartinThoma committed Dec 13, 2022
    Configuration menu
    Copy the full SHA
    10ab085 View commit details
    Browse the repository at this point in the history

Commits on Dec 15, 2022

  1. MAINT: Use typing.IO for file streams (#1498)

    In addition, the following changes were made:
    
    * DEV: Add in-project virtual envs to .gitignore
    
    Many developers (like myself) like to use virtual environments included within
    the current project. These virtual environment are local development constructs
    and should not be checked into source control.
    
    This commit adds two common virtual environment directory names to the
    .gitignore to avoid accidental commits from future developers.
    
    * DEV: Include `pillow` in `requirements/dev.in`
    
    The current contribution instructions in `docs/dev/intro.md` direct new code
    contributors to install the `dev` requirements. After following that
    instruction, the minimal test suite fails.
    
    This commit adds `pillow` to  `requirements/dev.in` so that the minimal test
    suite can pass on the first try so that new code contributors can start
    implementing improvements with confidence.
    
    * STY: Use official `IO` type for file streams
    
    The Python standard library provides the `IO` type for file streams. (Source:
    https://docs.python.org/3/library/typing.html#typing.IO)
    
    This commit replaces the complex Union type of the `IO` implementations with the
    official `IO` type. This will improve the accuracy of type checking in users'
    IDEs.
    
    * STY: Use standard `IO` type hint for writers
    
    The CI system flagged some additional conflicts with the `IO` type in the writer
    classes.
    
    This commit changes the writer classes to use the standard `IO` type instead of
    the union of IO implementations.
    thehale authored Dec 15, 2022
    Configuration menu
    Copy the full SHA
    b8f787e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    c95eabf View commit details
    Browse the repository at this point in the history

Commits on Dec 17, 2022

  1. MAINT: Deprecate features with PyPDF2==3.0.0 (#1489)

    Deprecate features, but keep helpful exceptions. That means that the names still need to be there.
    
    The deprecated names will stay until 4.0.0 to help the community transition to the new names.
    MartinThoma authored Dec 17, 2022
    Configuration menu
    Copy the full SHA
    a4629d3 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    9b23a39 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    e5e26ad View commit details
    Browse the repository at this point in the history

Commits on Dec 20, 2022

  1. Configuration menu
    Copy the full SHA
    3fb9b69 View commit details
    Browse the repository at this point in the history

Commits on Dec 22, 2022

  1. REL: 3.0.0

    BREAKING CHANGES:
    -  Deprecate features with PyPDF2==3.0.0 (#1489)
    -  Refactor Fit / Zoom parameters (#1437)
    
    New Features (ENH):
    -  Add Cloning  (#1371)
    -  Allow int for indirect_reference in PdfWriter.get_object (#1490)
    
    Documentation (DOC):
    -  How to read PDFs from S3 (#1509)
    -  Make MyST parse all links as simple hyperlinks (#1506)
    -  Changed 'latest' for 'stable' generated docs (#1495)
    -  Adjust deprecation procedure (#1487)
    
    Maintenance (MAINT):
    -  Use typing.IO for file streams (#1498)
    
    [Full Changelog](2.12.1...3.0.0)
    MartinThoma committed Dec 22, 2022
    Configuration menu
    Copy the full SHA
    3214dde View commit details
    Browse the repository at this point in the history
Loading