summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/pdftexdir
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-11-27 22:45:26 +0000
committerKarl Berry <karl@freefriends.org>2019-11-27 22:45:26 +0000
commitfe35256c1179b58e1d6d71819bc3a5948b2e9e6f (patch)
tree030f87af94f07880f15fbfd49c9f23c3369110db /Build/source/texk/web2c/pdftexdir
parentdfa6c7d4a17b6c4622c7ca7ac1293dd21c44241f (diff)
new primitive \pdfmajorversion, from pdftex r817
git-svn-id: svn://tug.org/texlive/trunk@52953 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/pdftexdir')
-rw-r--r--Build/source/texk/web2c/pdftexdir/ChangeLog24
-rw-r--r--Build/source/texk/web2c/pdftexdir/NEWS2
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex-common.h2
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftex.web116
-rw-r--r--Build/source/texk/web2c/pdftexdir/pdftoepdf.cc12
-rw-r--r--Build/source/texk/web2c/pdftexdir/ptexlib.h4
-rw-r--r--Build/source/texk/web2c/pdftexdir/writeimg.c16
-rw-r--r--Build/source/texk/web2c/pdftexdir/writepng.c19
8 files changed, 124 insertions, 71 deletions
diff --git a/Build/source/texk/web2c/pdftexdir/ChangeLog b/Build/source/texk/web2c/pdftexdir/ChangeLog
index 10e4b6d8171..b1dfae5d67c 100644
--- a/Build/source/texk/web2c/pdftexdir/ChangeLog
+++ b/Build/source/texk/web2c/pdftexdir/ChangeLog
@@ -1,3 +1,27 @@
+2019-11-25 Joseph Wright <joseph.wright@morningstar2.co.uk>
+
+ * pdftex.web: New primitive \pdfmajorversion.
+ (pdf_major_version_code, pdf_major_version, print_param,
+ <Put each...>): housekeeping.
+ (<Initialize table entries...>): default 1.
+ (<Glob...>): fixed_pdf_major_version.
+ (pdf_version_written, <Set init...>): rename from
+ pdf_minor_version_written.
+ (check_pdfversion): rename from check_pdfminorversion,
+ and also check pdf_major_version for sanity, and set the fixed_ value,
+ and use pdf_major_version in the %PDF- line.
+ (pdf_begin_obj, pdf_begin_dict, <Initialize variables ...>,
+ <Implement \.{\\pdfximage}>): change call to check_pdfversion.
+ <Undump pdftex data>: undump pdf_major_version.
+ (scan_image): include pdf_major_version in call to read_image.
+ * pdftoepdf.cc (read_pdf_info): new arg major_pdf_version_wanted,
+ and check it when including PDF.
+ * ptexlib.h (readimage, undumpimagemeta): new integer args in decl.
+ * writeimg.c (readimage, undumpimagemeta): new arg
+ pdfmajorversion, and check it.
+ * writepng.c (read_png_info): check fixedpdfmajorversion
+ along with fixedpdfminorversion for various png color attributes.
+
2019-08-06 Karl Berry <karl@freefriends.org>
* tests/cnfline.test,
diff --git a/Build/source/texk/web2c/pdftexdir/NEWS b/Build/source/texk/web2c/pdftexdir/NEWS
index ddc933be4f0..e02e4299b6b 100644
--- a/Build/source/texk/web2c/pdftexdir/NEWS
+++ b/Build/source/texk/web2c/pdftexdir/NEWS
@@ -1,6 +1,8 @@
pdfTeX 3.14159265-2.6-1.40.20 (TeX Live 2019)
- changes:
- new primitive \expanded (from unreleased pdftex 1.50 branch + luatex).
+ - new primitive parameter \pdfmajorversion; 1 by default, but can be
+ set to any positive integer; affects only the %PDF- line.
- new primitive parameter \pdfomitcharset; zero by default to include
the /CharSet value from the PDF output as usual; setting to 1 omits
it, since it cannot feasibly be guaranteed correct as the PDF/A-2
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex-common.h b/Build/source/texk/web2c/pdftexdir/pdftex-common.h
index 307ba64a3c9..494e9f2d08f 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex-common.h
+++ b/Build/source/texk/web2c/pdftexdir/pdftex-common.h
@@ -83,7 +83,7 @@ extern fm_entry *lookup_fontmap(char *);
/* pdftoepdf.cc */
extern void epdf_check_mem(void);
extern void epdf_delete(void);
-extern int read_pdf_info(char *, char *, int, int, int, int);
+extern int read_pdf_info(char *, char *, int, int, int, int, int);
/* utils.c */
extern char *convertStringToPDFString(const char *in, int len);
diff --git a/Build/source/texk/web2c/pdftexdir/pdftex.web b/Build/source/texk/web2c/pdftexdir/pdftex.web
index 80b6e00f880..e8b8c1a236e 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftex.web
+++ b/Build/source/texk/web2c/pdftexdir/pdftex.web
@@ -5669,31 +5669,32 @@ that will be defined later.
@d pdf_unique_resname_code = pdftex_first_integer_code + 6 {generate unique names for resouces}
@d pdf_option_always_use_pdfpagebox_code = pdftex_first_integer_code + 7 {if the PDF inclusion should always use a specific PDF page box}
@d pdf_option_pdf_inclusion_errorlevel_code = pdftex_first_integer_code + 8 {if the PDF inclusion should treat pdfs newer than |pdf_minor_version| as an error}
-@d pdf_minor_version_code = pdftex_first_integer_code + 9 {fractional part of the PDF version produced}
-@d pdf_force_pagebox_code = pdftex_first_integer_code + 10 {if the PDF inclusion should always use a specific PDF page box}
-@d pdf_pagebox_code = pdftex_first_integer_code + 11 {default pagebox to use for PDF inclusion}
-@d pdf_inclusion_errorlevel_code = pdftex_first_integer_code + 12 {if the PDF inclusion should treat pdfs newer than |pdf_minor_version| as an error}
-@d pdf_gamma_code = pdftex_first_integer_code + 13
-@d pdf_image_gamma_code = pdftex_first_integer_code + 14
-@d pdf_image_hicolor_code = pdftex_first_integer_code + 15
-@d pdf_image_apply_gamma_code = pdftex_first_integer_code + 16
-@d pdf_adjust_spacing_code = pdftex_first_integer_code + 17 {level of spacing adjusting}
-@d pdf_protrude_chars_code = pdftex_first_integer_code + 18 {protrude chars at left/right edge of paragraphs}
-@d pdf_tracing_fonts_code = pdftex_first_integer_code + 19 {level of font detail in log}
-@d pdf_objcompresslevel_code = pdftex_first_integer_code + 20 {activate object streams}
-@d pdf_adjust_interword_glue_code = pdftex_first_integer_code + 21 {adjust interword glue?}
-@d pdf_prepend_kern_code = pdftex_first_integer_code + 22 {prepend kern before certain characters?}
-@d pdf_append_kern_code = pdftex_first_integer_code + 23 {append kern before certain characters?}
-@d pdf_gen_tounicode_code = pdftex_first_integer_code + 24 {generate ToUnicode for fonts?}
-@d pdf_draftmode_code = pdftex_first_integer_code + 25 {switch on draftmode if positive}
-@d pdf_inclusion_copy_font_code = pdftex_first_integer_code + 26 {generate ToUnicode for fonts?}
-@d pdf_suppress_warning_dup_dest_code = pdftex_first_integer_code + 27 {suppress warning about duplicated destinations}
-@d pdf_suppress_warning_dup_map_code = pdftex_first_integer_code + 28 {suppress warning about duplicated map lines}
-@d pdf_suppress_warning_page_group_code = pdftex_first_integer_code + 29 {suppress warning about multiple pdfs with page group}
-@d pdf_info_omit_date_code = pdftex_first_integer_code + 30 {omit generating CreationDate and ModDate}
-@d pdf_suppress_ptex_info_code = pdftex_first_integer_code + 31 {suppress /PTEX.* entries in PDF dictionaries}
-@d pdf_omit_charset_code = pdftex_first_integer_code + 32 {suppress /PTEX.* entries in PDF dictionaries}
-@d pdf_int_pars=pdftex_first_integer_code + 33 {total number of \pdfTeX's integer parameters}
+@d pdf_major_version_code = pdftex_first_integer_code + 9 {integer part of the PDF version produced}
+@d pdf_minor_version_code = pdftex_first_integer_code + 10 {fractional part of the PDF version produced}
+@d pdf_force_pagebox_code = pdftex_first_integer_code + 11 {if the PDF inclusion should always use a specific PDF page box}
+@d pdf_pagebox_code = pdftex_first_integer_code + 12 {default pagebox to use for PDF inclusion}
+@d pdf_inclusion_errorlevel_code = pdftex_first_integer_code + 13 {if the PDF inclusion should treat pdfs newer than |pdf_minor_version| as an error}
+@d pdf_gamma_code = pdftex_first_integer_code + 14
+@d pdf_image_gamma_code = pdftex_first_integer_code + 15
+@d pdf_image_hicolor_code = pdftex_first_integer_code + 16
+@d pdf_image_apply_gamma_code = pdftex_first_integer_code + 17
+@d pdf_adjust_spacing_code = pdftex_first_integer_code + 18 {level of spacing adjusting}
+@d pdf_protrude_chars_code = pdftex_first_integer_code + 19 {protrude chars at left/right edge of paragraphs}
+@d pdf_tracing_fonts_code = pdftex_first_integer_code + 20 {level of font detail in log}
+@d pdf_objcompresslevel_code = pdftex_first_integer_code + 21 {activate object streams}
+@d pdf_adjust_interword_glue_code = pdftex_first_integer_code + 22 {adjust interword glue?}
+@d pdf_prepend_kern_code = pdftex_first_integer_code + 23 {prepend kern before certain characters?}
+@d pdf_append_kern_code = pdftex_first_integer_code + 24 {append kern before certain characters?}
+@d pdf_gen_tounicode_code = pdftex_first_integer_code + 25 {generate ToUnicode for fonts?}
+@d pdf_draftmode_code = pdftex_first_integer_code + 26 {switch on draftmode if positive}
+@d pdf_inclusion_copy_font_code = pdftex_first_integer_code + 27 {generate ToUnicode for fonts?}
+@d pdf_suppress_warning_dup_dest_code = pdftex_first_integer_code + 28 {suppress warning about duplicated destinations}
+@d pdf_suppress_warning_dup_map_code = pdftex_first_integer_code + 29 {suppress warning about duplicated map lines}
+@d pdf_suppress_warning_page_group_code = pdftex_first_integer_code + 30 {suppress warning about multiple pdfs with page group}
+@d pdf_info_omit_date_code = pdftex_first_integer_code + 31 {omit generating CreationDate and ModDate}
+@d pdf_suppress_ptex_info_code = pdftex_first_integer_code + 32 {suppress /PTEX.* entries in PDF dictionaries}
+@d pdf_omit_charset_code = pdftex_first_integer_code + 33 {suppress /PTEX.* entries in PDF dictionaries}
+@d pdf_int_pars=pdftex_first_integer_code + 34 {total number of \pdfTeX's integer parameters}
@#
@d etex_int_base=pdf_int_pars {base for \eTeX's integer parameters}
@d tracing_assigns_code=etex_int_base {show assignments}
@@ -5789,6 +5790,7 @@ that will be defined later.
@d pdf_unique_resname == int_par(pdf_unique_resname_code)
@d pdf_option_always_use_pdfpagebox == int_par(pdf_option_always_use_pdfpagebox_code)
@d pdf_option_pdf_inclusion_errorlevel == int_par(pdf_option_pdf_inclusion_errorlevel_code)
+@d pdf_major_version == int_par(pdf_major_version_code)
@d pdf_minor_version == int_par(pdf_minor_version_code)
@d pdf_force_pagebox == int_par(pdf_force_pagebox_code)
@d pdf_pagebox == int_par(pdf_pagebox_code)
@@ -5890,6 +5892,7 @@ pdf_pk_resolution_code: print_esc("pdfpkresolution");
pdf_unique_resname_code: print_esc("pdfuniqueresname");
pdf_option_always_use_pdfpagebox_code: print_esc("pdfoptionalwaysusepdfpagebox");
pdf_option_pdf_inclusion_errorlevel_code: print_esc("pdfoptionpdfinclusionerrorlevel");
+pdf_major_version_code: print_esc("pdfmajorversion");
pdf_minor_version_code: print_esc("pdfminorversion");
pdf_force_pagebox_code: print_esc("pdfforcepagebox");
pdf_pagebox_code: print_esc("pdfpagebox");
@@ -6056,6 +6059,8 @@ primitive("pdfoptionalwaysusepdfpagebox",assign_int,int_base+pdf_option_always_u
@!@:pdf_option_always_use_pdfpagebox_}{\.{\\pdfoptionalwaysusepdfpagebox} primitive@>
primitive("pdfoptionpdfinclusionerrorlevel",assign_int,int_base+pdf_option_pdf_inclusion_errorlevel_code);@/
@!@:pdf_option_pdf_inclusion_errorlevel_}{\.{\\pdfoptionpdfinclusionerrorlevel} primitive@>
+primitive("pdfmajorversion",assign_int,int_base+pdf_major_version_code);@/
+@!@:pdf_major_version_}{\.{\\pdfmajorversion} primitive@>
primitive("pdfminorversion",assign_int,int_base+pdf_minor_version_code);@/
@!@:pdf_minor_version_}{\.{\\pdfminorversion} primitive@>
primitive("pdfforcepagebox",assign_int,int_base+pdf_force_pagebox_code);@/
@@ -15076,6 +15081,7 @@ pdf_compress_level := 9;
pdf_objcompresslevel := 0;
pdf_decimal_digits := 3;
pdf_image_resolution := 72;
+pdf_major_version := 1;
pdf_minor_version := 4;
pdf_gamma := 1000;
pdf_image_gamma := 2200;
@@ -15348,9 +15354,10 @@ end
@!pdf_gone: longinteger; {number of bytes that were flushed to output}
@!pdf_save_offset: longinteger; {to save |pdf_offset|}
@!zip_write_state: integer; {which state of compression we are in}
+@!fixed_pdf_major_version: integer; {fixed major part of the PDF version}
@!fixed_pdf_minor_version: integer; {fixed minor part of the PDF version}
@!fixed_pdf_objcompresslevel: integer; {fixed level for activating PDF object streams}
-@!pdf_minor_version_written: boolean; {flag if the PDF version has been written}
+@!pdf_version_written: boolean; {flag if the PDF version has been written}
@!fixed_pdfoutput: integer; {fixed output format}
@!fixed_pdfoutput_set: boolean; {|fixed_pdfoutput| has been set?}
@!fixed_gamma: integer;
@@ -15376,7 +15383,7 @@ pdf_os_buf_size := inf_pdf_os_buf_size;
pdf_buf := pdf_op_buf;
pdf_seek_write_length := false;
zip_write_state := no_zip;
-pdf_minor_version_written := false;
+pdf_version_written := false;
fixed_pdfoutput_set := false;
fixed_pdf_draftmode_set := false;
@@ -15392,22 +15399,37 @@ begin
fix_int := val;
end;
-@ This ensures that |pdfminorversion| is set only before any bytes have
-been written to the generated PDF file. Here also the PDF file is opened
-by |ensure_pdf_open| and the PDF header is written.
+@ This ensures that |pdf_major_version| and |pdf_minor_version| are set
+to reasonable values before any bytes have been written to the generated
+PDF file. We also save their current values in case the user tries to
+change them later, along with |pdf_objcompresslevel|,
+|pdf_image_hicolor|, and various other parameters that must be fixed
+before any PDF output happens.
-@p procedure check_pdfminorversion;
+Here also the PDF file is opened by |ensure_pdf_open| and the PDF header
+is written.
+
+@p procedure check_pdfversion;
begin
- if not pdf_minor_version_written then begin
- pdf_minor_version_written := true;
+ if not pdf_version_written then begin
+ pdf_version_written := true;
+ if pdf_major_version < 1 then begin
+ print_err("pdfTeX error (invalid pdfmajorversion)");
+ print_ln;
+ help2 ("The pdfmajorversion must be 1 or greater.")@/
+ ("I changed this to 1.");
+ int_error (pdf_major_version);
+ pdf_major_version := 1;
+ end;
if (pdf_minor_version < 0) or (pdf_minor_version > 9) then begin
- print_err("pdfTeX error (illegal pdfminorversion)");
+ print_err("pdfTeX error (invalid pdfminorversion)");
print_ln;
help2 ("The pdfminorversion must be between 0 and 9.")@/
("I changed this to 4.");
int_error (pdf_minor_version);
pdf_minor_version := 4;
end;
+ fixed_pdf_major_version := pdf_major_version;
fixed_pdf_minor_version := pdf_minor_version;
fixed_gamma := fix_int(pdf_gamma, 0, 1000000);
fixed_image_gamma := fix_int(pdf_image_gamma, 0, 1000000);
@@ -15416,18 +15438,21 @@ begin
fixed_pdf_objcompresslevel := fix_int(pdf_objcompresslevel, 0, 3);
fixed_pdf_draftmode := fix_int(pdf_draftmode, 0, 1);
fixed_inclusion_copy_font := fix_int(pdf_inclusion_copy_font, 0, 1);
- if (fixed_pdf_minor_version >= 5) and (fixed_pdf_objcompresslevel > 0) then
+ if ((fixed_pdf_major_version > 1) or (fixed_pdf_minor_version >= 5))
+ and (fixed_pdf_objcompresslevel > 0) then
pdf_os_enable := true
else begin
if fixed_pdf_objcompresslevel > 0 then begin
- pdf_warning("Object streams", "\pdfobjcompresslevel > 0 requires \pdfminorversion > 4. Object streams disabled now.", true, true);
+ pdf_warning("Object streams", "\pdfobjcompresslevel > 0 requires PDF-1.5 or greater. Object streams disabled now.", true, true);
fixed_pdf_objcompresslevel := 0;
end;
pdf_os_enable := false;
end;
ensure_pdf_open;
fix_pdfoutput;
- pdf_print("%PDF-1.");
+ pdf_print("%PDF-");
+ pdf_print_int(fixed_pdf_major_version);
+ pdf_print(".");
pdf_print_int_ln(fixed_pdf_minor_version);
pdf_print("%");
pdf_out(208); {'P' + 128}
@@ -15437,9 +15462,10 @@ begin
pdf_print_nl;
end
else begin
- if fixed_pdf_minor_version <> pdf_minor_version then
+ if (fixed_pdf_minor_version <> pdf_minor_version)
+ or (fixed_pdf_major_version <> pdf_major_version) then
pdf_error("setup",
- "\pdfminorversion cannot be changed after data is written to the PDF file");
+ "PDF version cannot be changed after data is written to the PDF file");
end;
end;
@@ -16769,7 +16795,7 @@ end;
procedure pdf_begin_obj(i: integer; pdf_os_level: integer); {begin a PDF object}
begin
- check_pdfminorversion;
+ check_pdfversion;
pdf_os_prepare_obj(i, pdf_os_level);
if not pdf_os_mode then begin
pdf_print_int(i);
@@ -16798,7 +16824,7 @@ end;
procedure pdf_begin_dict(i: integer; pdf_os_level: integer); {begin a PDF dictionary object}
begin
- check_pdfminorversion;
+ check_pdfversion;
pdf_os_prepare_obj(i, pdf_os_level);
if not pdf_os_mode then begin
pdf_print_int(i);
@@ -19647,7 +19673,7 @@ begin
end;
@ @<Initialize variables for \.{PDF} output@>=
-check_pdfminorversion;
+check_pdfversion;
prepare_mag;
fixed_decimal_digits := fix_int(pdf_decimal_digits, 0, 4);
min_bp_val :=
@@ -32999,7 +33025,7 @@ already in an earlier module.
@<Undump pdftex data@>=
begin
-undumpimagemeta(pdf_minor_version,pdf_inclusion_errorlevel); {the image information array }
+undumpimagemeta(pdf_major_version,pdf_minor_version,pdf_inclusion_errorlevel); {the image information array }
undump_int(pdf_mem_size);
pdf_mem := xrealloc_array(pdf_mem, integer, pdf_mem_size);
undump_int(pdf_mem_ptr);
@@ -34358,7 +34384,7 @@ begin
if pagebox = 0 then {no pagebox specification given}
pagebox := pdf_box_spec_crop;
obj_ximage_data(k) := read_image(s, page, named, colorspace, pagebox,
- pdf_minor_version,
+ pdf_major_version, pdf_minor_version,
pdf_inclusion_errorlevel);
if named <> 0 then flush_str(named);
flush_str(s);
@@ -34371,7 +34397,7 @@ end;
@ @<Implement \.{\\pdfximage}@>=
begin
check_pdfoutput("\pdfximage", true);
- check_pdfminorversion;
+ check_pdfversion;
scan_image;
end
diff --git a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
index 4db0c90a639..4242ce3e340 100644
--- a/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/Build/source/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -719,7 +719,7 @@ static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
int
read_pdf_info(char *image_name, char *page_name, int page_num,
- int pagebox_spec, int minor_pdf_version_wanted,
+ int pagebox_spec, int major_pdf_version_wanted, int minor_pdf_version_wanted,
int pdf_inclusion_errorlevel)
{
PdfDocument *pdf_doc;
@@ -747,21 +747,21 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
#ifdef POPPLER_VERSION
pdf_major_version_found = pdf_doc->doc->getPDFMajorVersion();
pdf_minor_version_found = pdf_doc->doc->getPDFMinorVersion();
- if ((pdf_major_version_found > 1)
+ if ((pdf_major_version_found > major_pdf_version_wanted)
|| (pdf_minor_version_found > minor_pdf_version_wanted)) {
const char *msg =
- "PDF inclusion: found PDF version <%d.%d>, but at most version <1.%d> allowed";
+ "PDF inclusion: found PDF version <%d.%d>, but at most version <%d.%d> allowed";
if (pdf_inclusion_errorlevel > 0) {
- pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted);
+ pdftex_fail(msg, pdf_major_version_found, pdf_minor_version_found, major_pdf_version_wanted, minor_pdf_version_wanted);
} else if (pdf_inclusion_errorlevel < 0) {
; /* do nothing */
} else { /* = 0, give warning */
- pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found, minor_pdf_version_wanted);
+ pdftex_warn(msg, pdf_major_version_found, pdf_minor_version_found, major_pdf_version_wanted, minor_pdf_version_wanted);
}
}
#else
pdf_version_found = pdf_doc->doc->getPDFVersion();
- pdf_version_wanted = 1 + (minor_pdf_version_wanted * 0.1);
+ pdf_version_wanted = major_pdf_version_wanted + (minor_pdf_version_wanted * 0.1);
if (pdf_version_found > pdf_version_wanted + 0.01) {
char msg[] =
"PDF inclusion: found PDF version <%.1f>, but at most version <%.1f> allowed";
diff --git a/Build/source/texk/web2c/pdftexdir/ptexlib.h b/Build/source/texk/web2c/pdftexdir/ptexlib.h
index 03feb672cc2..e11ab063194 100644
--- a/Build/source/texk/web2c/pdftexdir/ptexlib.h
+++ b/Build/source/texk/web2c/pdftexdir/ptexlib.h
@@ -301,13 +301,13 @@ extern integer imagecolordepth(integer);
extern integer getimagegroupref(integer);
extern void setimagegroupref(integer,integer);
extern integer readimage(strnumber, integer, strnumber, integer, integer,
- integer, integer);
+ integer, integer, integer);
extern void deleteimage(integer);
extern void img_free(void);
extern void updateimageprocset(integer);
extern void writeimage(integer);
extern void dumpimagemeta(void);
-extern void undumpimagemeta(integer, integer);
+extern void undumpimagemeta(integer, integer, integer);
/* writejbig2.c */
extern void flushjbig2page0objects(void);
diff --git a/Build/source/texk/web2c/pdftexdir/writeimg.c b/Build/source/texk/web2c/pdftexdir/writeimg.c
index 8455b03a5c7..c392df97c8d 100644
--- a/Build/source/texk/web2c/pdftexdir/writeimg.c
+++ b/Build/source/texk/web2c/pdftexdir/writeimg.c
@@ -292,7 +292,7 @@ static void checktypebyextension(integer img)
integer readimage(strnumber s, integer page_num, strnumber page_name,
integer colorspace, integer pagebox,
- integer pdfversion, integer pdfinclusionerrorlevel)
+ integer pdfmajorversion, integer pdfminorversion, integer pdfinclusionerrorlevel)
{
char *dest = NULL;
integer img = new_image_entry();
@@ -316,7 +316,7 @@ integer readimage(strnumber s, integer page_num, strnumber page_name,
pdf_ptr(img) = xtalloc(1, pdf_image_struct);
pdf_ptr(img)->page_box = pagebox;
page_num = read_pdf_info(img_name(img), dest, page_num, pagebox,
- pdfversion, pdfinclusionerrorlevel);
+ pdfmajorversion, pdfminorversion, pdfinclusionerrorlevel);
img_width(img) = bp2int(epdf_width);
img_height(img) = bp2int(epdf_height);
img_rotate(img) = epdf_rotate;
@@ -341,10 +341,10 @@ integer readimage(strnumber s, integer page_num, strnumber page_name,
read_jpg_info(img);
break;
case IMAGE_TYPE_JBIG2:
- if (pdfversion < 4) {
+ if (pdfmajorversion == 1 && pdfminorversion < 4) {
pdftex_fail
("JBIG2 images only possible with at least PDF 1.4; you are generating PDF 1.%i",
- (int) pdfversion);
+ (int) pdfminorversion);
}
jbig2_ptr(img) = xtalloc(1, JBIG2_IMAGE_INFO);
img_type(img) = IMAGE_TYPE_JBIG2;
@@ -507,7 +507,7 @@ void dumpimagemeta(void)
}
}
-void undumpimagemeta(integer pdfversion, integer pdfinclusionerrorlevel)
+void undumpimagemeta(integer pdfmajorversion, integer pdfminorversion, integer pdfinclusionerrorlevel)
{
int cur_image, img;
@@ -542,7 +542,7 @@ void undumpimagemeta(integer pdfversion, integer pdfinclusionerrorlevel)
undumpinteger(pdf_ptr(img)->selected_page);
read_pdf_info(img_name(img), NULL, pdf_ptr(img)->selected_page,
- pdf_ptr(img)->page_box, pdfversion,
+ pdf_ptr(img)->page_box, pdfmajorversion, pdfminorversion,
pdfinclusionerrorlevel);
img_width(img) = bp2int(epdf_width);
@@ -562,10 +562,10 @@ void undumpimagemeta(integer pdfversion, integer pdfinclusionerrorlevel)
read_jpg_info(img);
break;
case IMAGE_TYPE_JBIG2:
- if (pdfversion < 4) {
+ if (pdfmajorversion == 1 && pdfminorversion < 4) {
pdftex_fail
("JBIG2 images only possible with at least PDF 1.4; you are generating PDF 1.%i",
- (int) pdfversion);
+ (int) pdfminorversion);
}
jbig2_ptr(img) = xtalloc(1, JBIG2_IMAGE_INFO);
img_type(img) = IMAGE_TYPE_JBIG2;
diff --git a/Build/source/texk/web2c/pdftexdir/writepng.c b/Build/source/texk/web2c/pdftexdir/writepng.c
index b47721c9fd4..515ac56edb6 100644
--- a/Build/source/texk/web2c/pdftexdir/writepng.c
+++ b/Build/source/texk/web2c/pdftexdir/writepng.c
@@ -71,7 +71,7 @@ void read_png_info(integer img)
pdftex_fail("unsupported type of color_type <%i>",
png_get_color_type(png_ptr(img), png_info(img)));
}
- if (fixedpdfminorversion >= 4
+ if (fixedpdfmajorversion > 1 || fixedpdfminorversion >= 4
&& (png_get_color_type(png_ptr(img), png_info(img)) == PNG_COLOR_TYPE_GRAY_ALPHA
|| png_get_color_type(png_ptr(img), png_info(img)) == PNG_COLOR_TYPE_RGB_ALPHA)) {
/* png with alpha channel in device colours; we have to add a Page
@@ -520,7 +520,7 @@ void write_png(integer img)
png_get_PLTE(png_ptr(img), png_info(img), &palette, &num_palette);
- if (fixedpdfminorversion < 5)
+ if (fixedpdfmajorversion == 1 && fixedpdfminorversion < 5)
fixedimagehicolor = 0;
pdf_puts("/Type /XObject\n/Subtype /Image\n");
@@ -530,13 +530,13 @@ void write_png(integer img)
png_copy = false;
}
/* alpha channel support */
- if (fixedpdfminorversion < 4
+ if (fixedpdfmajorversion == 1 && fixedpdfminorversion < 4
&& png_get_color_type(png_ptr(img), png_info(img)) | PNG_COLOR_MASK_ALPHA) {
png_set_strip_alpha(png_ptr(img));
png_copy = false;
}
/* 16 bit depth support */
- if (fixedpdfminorversion < 5)
+ if (fixedpdfmajorversion == 1 && fixedpdfminorversion < 5)
fixedimagehicolor = 0;
if ((png_get_bit_depth(png_ptr(img), png_info(img)) == 16) && (fixedimagehicolor == 0)) {
png_set_strip_16(png_ptr(img));
@@ -564,7 +564,7 @@ void write_png(integer img)
(int) png_get_image_height(png_ptr(img), png_info(img)),
(int) png_get_bit_depth(png_ptr(img), png_info(img)));
pdf_puts("/ColorSpace ");
- if (png_copy && fixedpdfminorversion > 1
+ if (png_copy && (fixedpdfmajorversion > 1 || fixedpdfminorversion > 1)
&& png_get_interlace_type(png_ptr(img), png_info(img)) == PNG_INTERLACE_NONE
&& (png_get_color_type(png_ptr(img), png_info(img)) == PNG_COLOR_TYPE_GRAY
|| png_get_color_type(png_ptr(img), png_info(img)) == PNG_COLOR_TYPE_RGB)
@@ -611,8 +611,9 @@ void write_png(integer img)
tex_printf(" *** PNG copy skipped because:");
if (!png_copy)
tex_printf(" !png_copy");
- if (fixedpdfminorversion <= 1)
- tex_printf(" minorversion=%d", (int) fixedpdfminorversion);
+ if (fixedpdfmajorversion == 1 && fixedpdfminorversion <= 1)
+ tex_printf(" minorversion=%d (and majorversion=1)",
+ (int) fixedpdfminorversion);
if (png_get_interlace_type(png_ptr(img), png_info(img)) != PNG_INTERLACE_NONE)
tex_printf(" interlaced");
if (!((png_get_color_type(png_ptr(img), png_info(img)) == PNG_COLOR_TYPE_GRAY)
@@ -648,7 +649,7 @@ void write_png(integer img)
write_png_gray(img);
break;
case PNG_COLOR_TYPE_GRAY_ALPHA:
- if (fixedpdfminorversion >= 4) {
+ if (fixedpdfminorversion >= 4 || fixedpdfmajorversion > 1) {
write_png_gray_alpha(img);
last_png_needs_page_group = true;
} else
@@ -658,7 +659,7 @@ void write_png(integer img)
write_png_rgb(img);
break;
case PNG_COLOR_TYPE_RGB_ALPHA:
- if (fixedpdfminorversion >= 4) {
+ if (fixedpdfminorversion >= 4 || fixedpdfmajorversion > 1) {
write_png_rgb_alpha(img);
last_png_needs_page_group = true;
} else