pdfa: replace read_binary() with files()
This commit is contained in:
@@ -14,9 +14,10 @@ from pathlib import Path
|
||||
from typing import Dict, Iterator, Union
|
||||
|
||||
try:
|
||||
from importlib_resources import read_binary
|
||||
from importlib_resources import files as package_files
|
||||
except ImportError:
|
||||
from importlib.resources import read_binary
|
||||
from importlib.resources import files as package_files
|
||||
|
||||
import pikepdf
|
||||
import pkg_resources # deprecated
|
||||
|
||||
@@ -107,7 +108,7 @@ def generate_pdfa_ps(target_filename: Path, icc: str = 'sRGB'):
|
||||
if icc != 'sRGB':
|
||||
raise NotImplementedError("Only supporting sRGB")
|
||||
|
||||
bytes_icc_profile = read_binary('ocrmypdf.data', SRGB_ICC_PROFILE_NAME)
|
||||
bytes_icc_profile = (package_files('ocrmypdf.data') / SRGB_ICC_PROFILE).read_bytes()
|
||||
ps = '\n'.join(_make_postscript(icc, bytes_icc_profile, 3))
|
||||
|
||||
# We should have encoded everything to pure ASCII by this point, and
|
||||
|
||||
Reference in New Issue
Block a user