summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/pdf
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-03-25 12:44:48 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2016-03-25 12:44:48 +0000
commitfa3e48ffa8e9e44b7d15902701f839babbfb6421 (patch)
tree9747ef1145378f1c7399ffddf1f413edfb43d391 /Build/source/texk/web2c/luatexdir/pdf
parentd9b87d6ab23197117e56d07a09b0f0d9cf7be572 (diff)
web2c/luatexdir: sync with the upstream
git-svn-id: svn://tug.org/texlive/trunk@40135 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/pdf')
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.w100
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdftables.h4
2 files changed, 61 insertions, 43 deletions
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
index 5882d0b6f72..c5db4c71413 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.w
@@ -1425,48 +1425,60 @@ and that they should be reasonably unique. Since it's difficult to get the file
size at this point in the execution of pdfTeX and scanning the info dict is also
difficult, we start with a simpler implementation using just the first two items.
+
@c
static void print_ID(PDF pdf)
{
- time_t t;
- size_t size;
- char time_str[32];
- md5_state_t state;
- md5_byte_t digest[16];
- char id[64];
- char pwd[4096];
- /* start md5 */
- md5_init(&state);
- /* get the time */
- t = time(NULL);
- size = strftime(time_str, sizeof(time_str), "%Y%m%dT%H%M%SZ", gmtime(&t));
- md5_append(&state, (const md5_byte_t *) time_str, (int) size);
- /* get the file name */
- if (getcwd(pwd, sizeof(pwd)) == NULL)
- formatted_error("pdf backend","getcwd() failed (%s), (path too long?)", strerror(errno));
+ if ((pdf_suppress_optional_info & 512) == 0) {
+ if (pdf_trailer_id != 0) {
+ char *s = NULL;
+ int len;
+ s = tokenlist_to_cstring(pdf_trailer_id, true, &len);
+ /* this had better be an array! sp maybe we need to check for [] and error otherwise */
+ pdf_add_name(pdf, "ID");
+ pdf_out_block(pdf,s,len);
+ } else {
+ time_t t;
+ size_t size;
+ char time_str[32];
+ md5_state_t state;
+ md5_byte_t digest[16];
+ char id[64];
+ char pwd[4096];
+ /* start md5 */
+ md5_init(&state);
+ /* get the time */
+ t = time(NULL);
+ size = strftime(time_str, sizeof(time_str), "%Y%m%dT%H%M%SZ", gmtime(&t));
+ md5_append(&state, (const md5_byte_t *) time_str, (int) size);
+ /* get the file name */
+ if (getcwd(pwd, sizeof(pwd)) == NULL) {
+ formatted_error("pdf backend","getcwd() failed (%s), (path too long?)", strerror(errno));
+ }
#ifdef WIN32
- {
- char *p;
- for (p = pwd; *p; p++) {
- if (*p == '\\')
- *p = '/';
- else if (IS_KANJI(p))
- p++;
+ {
+ char *p;
+ for (p = pwd; *p; p++) {
+ if (*p == '\\')
+ *p = '/';
+ else if (IS_KANJI(p))
+ p++;
+ }
+ }
+#endif
+ md5_append(&state, (const md5_byte_t *) pwd, (int) strlen(pwd));
+ md5_append(&state, (const md5_byte_t *) "/", 1);
+ md5_append(&state, (const md5_byte_t *) pdf->file_name, (int) strlen(pdf->file_name));
+ /* finish md5 */
+ md5_finish(&state, digest);
+ /* write the IDs */
+ convertStringToHexString((char *) digest, id, 16);
+ pdf_add_name(pdf, "ID");
+ pdf_begin_array(pdf);
+ pdf_printf(pdf, "<%s> <%s>", id, id);
+ pdf_end_array(pdf);
}
}
-#endif
- md5_append(&state, (const md5_byte_t *) pwd, (int) strlen(pwd));
- md5_append(&state, (const md5_byte_t *) "/", 1);
- md5_append(&state, (const md5_byte_t *) pdf->file_name,
- (int) strlen(pdf->file_name));
- /* finish md5 */
- md5_finish(&state, digest);
- /* write the IDs */
- convertStringToHexString((char *) digest, id, 16);
- pdf_add_name(pdf, "ID");
- pdf_begin_array(pdf);
- pdf_printf(pdf, "<%s> <%s>", id, id);
- pdf_end_array(pdf);
}
@ Print the /CreationDate entry.
@@ -2155,8 +2167,7 @@ static int pdf_print_info(PDF pdf, int luatexversion,
pdf_puts(pdf, p); /* no free, pointer */
pdf_out(pdf, '\n');
}
- if (!producer_given) {
- /* Print the Producer key */
+ if ((pdf_suppress_optional_info & 128) == 0 && !producer_given) {
pdf_add_name(pdf, "Producer");
pdf_puts(pdf, " (LuaTeX-");
pdf_print_int(pdf, luatexversion / 100);
@@ -2166,20 +2177,23 @@ static int pdf_print_info(PDF pdf, int luatexversion,
pdf_print(pdf, luatexrevision);
pdf_out(pdf, ')');
}
- if (!creator_given)
+ if ((pdf_suppress_optional_info & 16) == 0 && !creator_given) {
pdf_dict_add_string(pdf, "Creator", "TeX");
- if (!creationdate_given) {
+ }
+ if ((pdf_suppress_optional_info & 32) == 0 && !creationdate_given) {
init_start_time(pdf);
pdf_dict_add_string(pdf, "CreationDate", pdf->start_time_str);
}
- if (!moddate_given) {
+ if ((pdf_suppress_optional_info & 64) == 0 && !moddate_given) {
init_start_time(pdf);
pdf_dict_add_string(pdf, "ModDate", pdf->start_time_str);
}
- if (!trapped_given) {
+ if ((pdf_suppress_optional_info & 256) == 0 && !trapped_given) {
pdf_dict_add_name(pdf, "Trapped", "False");
}
- pdf_dict_add_string(pdf, "PTEX.Fullbanner", luatex_banner);
+ if ((pdf_suppress_optional_info & 1) == 0) {
+ pdf_dict_add_string(pdf, "PTEX.FullBanner", luatex_banner);
+ }
pdf_end_dict(pdf);
pdf_end_obj(pdf);
return k;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
index ee1d1832103..f185ab5c11e 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdftables.h
@@ -132,6 +132,7 @@ typedef enum {
c_pdf_inclusion_copy_font,
c_pdf_gen_tounicode,
c_pdf_pk_fixed_dpi,
+ c_pdf_suppress_optional_info,
} pdf_backend_counters ;
typedef enum {
@@ -150,6 +151,7 @@ typedef enum {
t_pdf_xform_attr,
t_pdf_xform_resources,
t_pdf_pk_mode,
+ t_pdf_trailer_id,
} pdf_backend_tokenlists ;
extern int pdf_last_annot;
@@ -175,6 +177,7 @@ extern int pdf_retval;
# define pdf_inclusion_copy_font get_tex_extension_count_register(c_pdf_inclusion_copy_font)
# define pdf_gen_tounicode get_tex_extension_count_register(c_pdf_gen_tounicode)
# define pdf_pk_fixed_dpi get_tex_extension_count_register(c_pdf_pk_fixed_dpi)
+# define pdf_suppress_optional_info get_tex_extension_count_register(c_pdf_suppress_optional_info)
# define pdf_h_origin get_tex_extension_dimen_register(d_pdf_h_origin)
# define pdf_v_origin get_tex_extension_dimen_register(d_pdf_v_origin)
@@ -189,6 +192,7 @@ extern int pdf_retval;
# define pdf_xform_attr get_tex_extension_toks_register(t_pdf_xform_attr)
# define pdf_xform_resources get_tex_extension_toks_register(t_pdf_xform_resources)
# define pdf_pk_mode get_tex_extension_toks_register(t_pdf_pk_mode)
+# define pdf_trailer_id get_tex_extension_toks_register(t_pdf_trailer_id)
# define set_pdf_minor_version(i) set_tex_extension_count_register(c_pdf_minor_version,i)
# define set_pdf_compress_level(i) set_tex_extension_count_register(c_pdf_compress_level,i)