Skip to content

Commit

Permalink
Remove old import to import ICC file
Browse files Browse the repository at this point in the history
  • Loading branch information
liZe committed Jun 24, 2024
1 parent beb17af commit 8fc79e3
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions weasyprint/pdf/pdfa.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
"""PDF/A generation."""

try:
# Available in Python 3.9+
from importlib.resources import files
except ImportError:
# Deprecated in Python 3.11+
from importlib.resources import read_binary
else:
def read_binary(package, resource):
return (files(package) / resource).read_bytes()

from functools import partial
from importlib.resources import files

import pydyf

Expand All @@ -22,7 +13,7 @@ def pdfa(pdf, metadata, document, page_streams, attachments, compress,
"""Set metadata for PDF/A documents."""
# Add ICC profile.
profile = pydyf.Stream(
[read_binary(__package__, 'sRGB2014.icc')],
(files(__package__) / 'sRGB2014.icc').read_bytes(),
pydyf.Dictionary({'N': 3, 'Alternate': '/DeviceRGB'}),
compress=compress)
pdf.add_object(profile)
Expand Down

0 comments on commit 8fc79e3

Please sign in to comment.