From 0ad15e25fa695f2d66c3ae060016b0832722ec74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C5=82gorzata=20Filipek?= Date: Thu, 17 Nov 2022 13:17:54 +0100 Subject: [PATCH 1/4] resolve1 on width in pdffont resolve1 on elements of self.attr['MediaBox'] in pdfpage --- pdfminer/pdffont.py | 2 +- pdfminer/pdfpage.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pdfminer/pdffont.py b/pdfminer/pdffont.py index 13629c77..3cebab45 100644 --- a/pdfminer/pdffont.py +++ b/pdfminer/pdffont.py @@ -995,7 +995,7 @@ def __init__(self, rsrcmgr: "PDFResourceManager", spec: Mapping[str, Any]) -> No firstchar = int_value(spec.get("FirstChar", 0)) # lastchar = int_value(spec.get('LastChar', 255)) width_list = list_value(spec.get("Widths", [0] * 256)) - widths = {i + firstchar: w for (i, w) in enumerate(width_list)} + widths = {i + firstchar: resolve1(w) for (i, w) in enumerate(width_list)} PDFSimpleFont.__init__(self, descriptor, widths, spec) if "Encoding" not in spec and "FontFile" in descriptor: # try to recover the missing encoding info from the font file. diff --git a/pdfminer/pdfpage.py b/pdfminer/pdfpage.py index 13bbb14d..d33f0919 100644 --- a/pdfminer/pdfpage.py +++ b/pdfminer/pdfpage.py @@ -60,7 +60,8 @@ def __init__( self.resources: Dict[object, object] = resolve1( self.attrs.get("Resources", dict()) ) - self.mediabox: Rect = resolve1(self.attrs["MediaBox"]) + mediabox_params: list = [resolve1(mediabox_param) for mediabox_param in self.attrs['MediaBox']] + self.mediabox: Rect = resolve1(mediabox_params) if "CropBox" in self.attrs: self.cropbox: Rect = resolve1(self.attrs["CropBox"]) else: From d6cb05969600c06c1bf680cd0d25226c6c019f3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C5=82gorzata=20Filipek?= Date: Tue, 29 Nov 2022 12:08:15 +0100 Subject: [PATCH 2/4] fixed bugs from nox --- pdfminer/pdfpage.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pdfminer/pdfpage.py b/pdfminer/pdfpage.py index d33f0919..b96a3cac 100644 --- a/pdfminer/pdfpage.py +++ b/pdfminer/pdfpage.py @@ -1,6 +1,6 @@ import itertools import logging -from typing import BinaryIO, Container, Dict, Iterator, List, Optional, Tuple +from typing import BinaryIO, Container, Dict, Iterator, List, Optional, Tuple, Any from pdfminer.utils import Rect from . import settings @@ -60,7 +60,9 @@ def __init__( self.resources: Dict[object, object] = resolve1( self.attrs.get("Resources", dict()) ) - mediabox_params: list = [resolve1(mediabox_param) for mediabox_param in self.attrs['MediaBox']] + mediabox_params: List[Any] = [ + resolve1(mediabox_param) for mediabox_param in self.attrs["MediaBox"] + ] self.mediabox: Rect = resolve1(mediabox_params) if "CropBox" in self.attrs: self.cropbox: Rect = resolve1(self.attrs["CropBox"]) From bd252ef5a578694efffdb1e42b24deea22f78d17 Mon Sep 17 00:00:00 2001 From: Pieter Marsman Date: Thu, 28 Dec 2023 22:20:33 +0100 Subject: [PATCH 3/4] Bump version in CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9c16648..40273f19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +Nothing yet. + +## [20231228] + ### Removed - Support for Python 3.6 and 3.7 ([#921](https://github.com/pdfminer/pdfminer.six/pull/921)) From 9b69c7e1dbcde70c7601b15894d9a6594d302988 Mon Sep 17 00:00:00 2001 From: Pieter Marsman Date: Fri, 29 Dec 2023 21:55:10 +0100 Subject: [PATCH 4/4] Add changelog --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 40273f19..0eb78482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,7 +5,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] -Nothing yet. +### Fixed + +- Resolving mediabox and pdffont ([#834](https://github.com/pdfminer/pdfminer.six/pull/834)) ## [20231228]