forked from reingart/pyfpdf
-
Notifications
You must be signed in to change notification settings - Fork 266
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pleasing VeraPDF / fixing ICC profiles insertion / warn on CMYK not s…
…upported - close #697
- Loading branch information
Showing
10 changed files
with
55 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,21 @@ | ||
from pathlib import Path | ||
|
||
import fpdf | ||
from fpdf import FPDF | ||
from test.conftest import assert_pdf_equal | ||
|
||
|
||
HERE = Path(__file__).resolve().parent | ||
|
||
|
||
def test_insert_png_files(tmp_path): | ||
pdf = fpdf.FPDF(unit="pt") | ||
pdf.compress = False | ||
|
||
not_supported = { | ||
"e59ec0cfb8ab64558099543dc19f8378.png", # Interlacing not supported: | ||
"6c853ed9dacd5716bc54eb59cec30889.png", # 16-bit depth not supported: | ||
"ac6343a98f8edabfcc6e536dd75aacb0.png", # Interlacing not supported: | ||
"93e6127b9c4e7a99459c558b81d31bc5.png", # Interlacing not supported: | ||
"18f9baf3834980f4b80a3e82ad45be48.png", # Interlacing not supported: | ||
"51a4d21670dc8dfa8ffc9e54afd62f5f.png", # Interlacing not supported: | ||
} | ||
|
||
def test_insert_png_files(caplog, tmp_path): | ||
pdf = FPDF() | ||
for path in sorted(HERE.glob("*.png")): | ||
if path.name not in not_supported: | ||
pdf.add_page() | ||
pdf.image(str(path), x=0, y=0, w=0, h=0) | ||
|
||
pdf.add_page() | ||
pdf.image(str(path), x=0, y=0, w=0, h=0) | ||
# Note: 7 of those images have an ICC profile, and there are only 5 distinct ICC profiles among them | ||
assert_pdf_equal(pdf, HERE / "image_png_insert_png_files.pdf", tmp_path) | ||
|
||
assert "Unsupported color space CMYK in ICC Profile of file" in caplog.text | ||
# Note: the warning above comes from the following files, for which ImageMagics also raise warnings: | ||
# identify-im6.q16: iCCP: profile 'icc': 'CMYK': invalid ICC profile color space `test/image/png_images/0839d93f8e77e21acd0ac40a80b14b7b.png' | ||
# identify-im6.q16: iCCP: profile 'icc': 'CMYK': invalid ICC profile color space `test/image/png_images/1ebd73c1d3fbc89782f29507364128fc.png' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters