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] diff --git a/pdfminer/pdffont.py b/pdfminer/pdffont.py index 63826b96..118b9a0e 100644 --- a/pdfminer/pdffont.py +++ b/pdfminer/pdffont.py @@ -1001,7 +1001,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..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,10 @@ def __init__( self.resources: Dict[object, object] = resolve1( self.attrs.get("Resources", dict()) ) - self.mediabox: Rect = resolve1(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"]) else: