Skip to content

Commit

Permalink
#833 PDFObj instead of int (#834)
Browse files Browse the repository at this point in the history
Co-authored-by: Małgorzata Filipek <mfilipek@biinsight.pl>
Co-authored-by: Pieter Marsman <pietermarsman@gmail.com>
  • Loading branch information
3 people authored Dec 29, 2023
1 parent 23035a6 commit dba5cc8
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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]

2 changes: 1 addition & 1 deletion pdfminer/pdffont.py
Original file line number Diff line number Diff line change
@@ -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.
7 changes: 5 additions & 2 deletions pdfminer/pdfpage.py
Original file line number Diff line number Diff line change
@@ -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:

0 comments on commit dba5cc8

Please sign in to comment.