summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/image
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/image
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/image')
-rw-r--r--Build/source/texk/web2c/luatexdir/image/epdf.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/image/pdftoepdf.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/image/pdftoepdf.w25
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writeimg.w9
4 files changed, 20 insertions, 18 deletions
diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h
index 3d4751c4587..57bb2e39ae9 100644
--- a/Build/source/texk/web2c/luatexdir/image/epdf.h
+++ b/Build/source/texk/web2c/luatexdir/image/epdf.h
@@ -123,7 +123,7 @@ extern "C" {
/* pdftoepdf.cc */
extern void read_pdf_info(image_dict *);
extern void flush_pdf_info(image_dict *);
- extern void write_epdf(PDF, image_dict *);
+ extern void write_epdf(PDF, image_dict *, int suppress_optional_info);
extern void unrefPdfDocument(char *);
extern void unrefMemStreamPdfDocument(char *);
extern void epdf_free(void);
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h
index 12d15121017..0a8ef942c0e 100644
--- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h
+++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.h
@@ -29,7 +29,7 @@ void flush_pdf_info(image_dict *);
/* flush_pdfstream_info(image_dict *); */ /* somehow doesn't work due to xfree macro */
void unrefPdfDocument(char *);
void unrefMemStreamPdfDocument(char *);
-void write_epdf(PDF, image_dict *);
+void write_epdf(PDF, image_dict *, int suppress_optional_info);
void epdf_check_mem(void);
void copyReal(PDF pdf, double d);
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
index b9d496ac9f0..d86504f82bc 100644
--- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -707,7 +707,7 @@ void read_pdf_info(image_dict * idict)
that can happen during PDF inclusion will arise here.
*/
-void write_epdf(PDF pdf, image_dict * idict)
+void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info)
{
PdfDocument *pdf_doc = NULL;
PDFDoc *doc = NULL;
@@ -719,7 +719,7 @@ void write_epdf(PDF pdf, image_dict * idict)
PDFRectangle *pagebox;
int i, l;
double bbox[4];
- char s[256];
+ /* char s[256]; */
const char *pagedictkeys[] = {
"Group", "LastModified", "Metadata", "PieceInfo", "Resources", "SeparationInfo", NULL
};
@@ -743,20 +743,23 @@ void write_epdf(PDF pdf, image_dict * idict)
pdf_begin_dict(pdf);
pdf_dict_add_name(pdf, "Type", "XObject");
pdf_dict_add_name(pdf, "Subtype", "Form");
- if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0)
+ if (img_attr(idict) != NULL && strlen(img_attr(idict)) > 0) {
pdf_printf(pdf, "\n%s\n", img_attr(idict));
+ }
pdf_dict_add_int(pdf, "FormType", 1);
/* write additional information */
pdf_dict_add_img_filename(pdf, idict);
- snprintf(s, 30, "%s.PageNumber", pdfkeyprefix);
- pdf_dict_add_int(pdf, s, (int) img_pagenum(idict));
- doc->getDocInfoNF(&obj1);
- if (obj1.isRef()) {
- /* the info dict must be indirect (PDF Ref p. 61) */
- snprintf(s, 30, "%s.InfoDict", pdfkeyprefix);
- pdf_dict_add_ref(pdf, s, addInObj(pdf, pdf_doc, obj1.getRef()));
+ if ((suppress_optional_info & 4) == 0) {
+ pdf_dict_add_int(pdf, "PTEX.PageNumber", (int) img_pagenum(idict));
+ }
+ if ((suppress_optional_info & 8) == 0) {
+ doc->getDocInfoNF(&obj1);
+ if (obj1.isRef()) {
+ /* the info dict must be indirect (PDF Ref p. 61) */
+ pdf_dict_add_ref(pdf, "PTEX.InfoDict", addInObj(pdf, pdf_doc, obj1.getRef()));
+ }
+ obj1.free();
}
- obj1.free();
if (img_is_bbox(idict)) {
bbox[0] = sp2bp(img_bbox(idict)[0]);
bbox[1] = sp2bp(img_bbox(idict)[1]);
diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.w b/Build/source/texk/web2c/luatexdir/image/writeimg.w
index 7407d228a0f..f8e035f549d 100644
--- a/Build/source/texk/web2c/luatexdir/image/writeimg.w
+++ b/Build/source/texk/web2c/luatexdir/image/writeimg.w
@@ -589,7 +589,7 @@ void write_img(PDF pdf, image_dict * idict)
break;
case IMG_TYPE_PDFMEMSTREAM:
case IMG_TYPE_PDF:
- write_epdf(pdf, idict);
+ write_epdf(pdf, idict,(int) pdf_suppress_optional_info);
break;
case IMG_TYPE_PDFSTREAM:
write_pdfstream(pdf, idict);
@@ -666,8 +666,8 @@ void idict_to_array(image_dict * idict)
void pdf_dict_add_img_filename(PDF pdf, image_dict * idict)
{
- char s[21], *p;
- if (pdf_image_addfilename>0) {
+ char *p;
+ if ((pdf_image_addfilename > 0) && ((pdf_suppress_optional_info & 2) == 0)) {
/* for now PTEX.FileName only for PDF, but prepared for JPG, PNG, ... */
if (! ( (img_type(idict) == IMG_TYPE_PDF) || (img_type(idict) == IMG_TYPE_PDFMEMSTREAM) ))
return;
@@ -682,8 +682,7 @@ void pdf_dict_add_img_filename(PDF pdf, image_dict * idict)
p = img_filepath(idict);
}
// write additional information
- snprintf(s, 20, "%s.FileName", pdfkeyprefix);
- pdf_add_name(pdf, s);
+ pdf_add_name(pdf, "PTEX.FileName");
pdf_printf(pdf, " (%s)", convertStringToPDFString(p, strlen(p)));
}
}