Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#833 PDFObj instead of int #834

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: