w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pdfximage.c
Go to the documentation of this file.
1 /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks.
2 
3  Copyright (C) 2002-2021 by Jin-Hwan Cho and Shunsaku Hirata,
4  the dvipdfmx project team.
5 
6  Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu>
7 
8  This program is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 2 of the License, or
11  (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 */
22 
23 #ifdef HAVE_CONFIG_H
24 #include <config.h>
25 #endif
26 
27 #include "system.h"
28 #include "error.h"
29 #include "mem.h"
30 
31 #include "dpxconf.h"
32 #include "dpxfile.h"
33 #include "dpxutil.h"
34 
35 #include "pdfobj.h"
36 
37 #include "pdfdoc.h"
38 #include "pdfdev.h"
39 #include "pdfdraw.h"
40 #include "pdfnames.h"
41 
42 #include "epdf.h"
43 #include "mpost.h"
44 #include "pngimage.h"
45 #include "jpegimage.h"
46 #include "jp2image.h"
47 #include "bmpimage.h"
48 
49 #include "pdfximage.h"
50 
51 static int check_for_ps (FILE *image_file);
52 static int check_for_mp (FILE *image_file);
53 static int ps_include_page (pdf_ximage *ximage,
54  const char *ident, load_options options);
55 
56 
57 #define IMAGE_TYPE_UNKNOWN -1
58 #define IMAGE_TYPE_PDF 0
59 #define IMAGE_TYPE_JPEG 1
60 #define IMAGE_TYPE_PNG 2
61 #define IMAGE_TYPE_MPS 4
62 #define IMAGE_TYPE_EPS 5
63 #define IMAGE_TYPE_BMP 6
64 #define IMAGE_TYPE_JP2 7
65 
66 #if defined(_WIN32)
67 extern int fsyscp_stat(const char *path, struct stat *buffer);
68 #endif /* _WIN32 */
69 
70 struct attr_
71 {
72  int width, height;
73  double xdensity, ydensity;
74  pdf_rect bbox;
75 
76  /* Not appropriate place but... someone need them. */
77  int page_no;
78  int page_count;
79  int bbox_type; /* Ugh */
80  pdf_obj *dict;
81  char tempfile;
82 };
83 
84 struct pdf_ximage_
85 {
86  char *ident;
87  char res_name[16];
88 
89  int subtype;
90 
91  struct attr_ attr;
92 
93  char *filename;
94  char *fullname;
97 
98  int reserved;
99 };
100 
101 
102 /* verbose, verbose, verbose... */
103 struct opt_
104 {
105  char *cmdtmpl;
106 };
107 
108 static struct opt_ _opts = {
109  NULL
110 };
111 
112 struct ic_
113 {
114  int count, capacity;
116 };
117 
118 static struct ic_ _ic = {
119  0, 0, NULL
120 };
121 
122 static void
124 {
125  I->ident = NULL;
126  I->filename = NULL;
127  I->fullname = NULL;
128 
129  I->subtype = -1;
130  memset(I->res_name, 0, 16);
131  I->reference = NULL;
132  I->resource = NULL;
133  I->reserved = 0;
134 
135  I->attr.width = I->attr.height = 0;
136  I->attr.xdensity = I->attr.ydensity = 1.0;
137  I->attr.bbox.llx = I->attr.bbox.lly = 0;
138  I->attr.bbox.urx = I->attr.bbox.ury = 0;
139 
140  I->attr.page_no = 1;
141  I->attr.page_count = 1;
142  I->attr.bbox_type = 0;
143 
144  I->attr.dict = NULL;
145  I->attr.tempfile = 0;
146 }
147 
148 static void
149 pdf_set_ximage_tempfile (pdf_ximage *I, const char *fullname)
150 {
151  if (I->fullname)
152  RELEASE(I->fullname);
153  I->fullname = NEW(strlen(fullname)+1, char);
154  strcpy(I->fullname, fullname);
155  I->attr.tempfile = 1;
156 }
157 
158 static void
160 {
161  if (I->ident)
162  RELEASE(I->ident);
163  if (I->filename)
164  RELEASE(I->filename);
165  if (I->fullname)
166  RELEASE(I->fullname);
167  if (I->reference)
168  pdf_release_obj(I->reference);
169  if (I->resource)
170  pdf_release_obj(I->resource);
171  if (I->attr.dict) /* unsafe? */
172  pdf_release_obj(I->attr.dict);
174 }
175 
176 
177 void
179 {
180  struct ic_ *ic = &_ic;
181  ic->count = 0;
182  ic->capacity = 0;
183  ic->ximages = NULL;
184 }
185 
186 void
188 {
189  struct ic_ *ic = &_ic;
190  if (ic->ximages) {
191  int i;
192  for (i = 0; i < ic->count; i++) {
193  pdf_ximage *I = ic->ximages+i;
194  if (I->attr.tempfile) {
195  /*
196  * It is important to remove temporary files at the end because
197  * we cache file names. Since we use mkstemp to create them, we
198  * might get the same file name again if we delete the first file.
199  * (This happens on NetBSD, reported by Jukka Salmi.)
200  * We also use this to convert a PS file only once if multiple
201  * pages are imported from that file.
202  */
203  if (dpx_conf.verbose_level > 1 &&
204  dpx_conf.file.keep_cache != 1)
205  MESG("pdf_image>> deleting temporary file \"%s\"\n", I->filename);
206  dpx_delete_temp_file(I->fullname, false); /* temporary filename freed here */
207  I->fullname = NULL;
208  }
210  }
211  RELEASE(ic->ximages);
212  ic->ximages = NULL;
213  ic->count = ic->capacity = 0;
214  }
215 
216  if (_opts.cmdtmpl)
218  _opts.cmdtmpl = NULL;
219 }
220 
221 static int
223 {
225 
226  rewind(fp);
227  /*
228  * Make sure we check for PS *after* checking for MP since
229  * MP is a special case of PS.
230  */
231  if (check_for_jpeg(fp))
232  {
234  }
235  else if (check_for_jp2(fp))
236  {
238  }
239 #ifdef HAVE_LIBPNG
240  else if (check_for_png(fp))
241  {
243  }
244 #endif
245  else if (check_for_bmp(fp))
246  {
248  } else if (check_for_pdf(fp)) {
250  } else if (check_for_mp(fp)) {
252  } else if (check_for_ps(fp)) {
254  } else {
256  }
257  rewind(fp);
258 
259  return format;
260 }
261 
262 static int
263 load_image (const char *ident, const char *filename, const char *fullname, int format, FILE *fp,
265 {
266  struct ic_ *ic = &_ic;
267  int id = -1, reserved = 0;
268  pdf_ximage *I;
269 
270  if (ident) {
271  for (id = 0; id < ic->count; id++) {
272  I = &ic->ximages[id];
273  if (I->ident && !strcmp(ident, I->ident)) {
274  if (I->reserved) {
275  reserved = 1;
276  break;
277  }
278  }
279  }
280  }
281  if (!reserved) {
282  id = ic->count;
283  if (ic->count >= ic->capacity) {
284  ic->capacity += 16;
285  ic->ximages = RENEW(ic->ximages, ic->capacity, pdf_ximage);
286  }
287  I = &ic->ximages[id];
289  if (ident) {
290  I->ident = NEW(strlen(ident)+1, char);
291  strcpy(I->ident, ident);
292  }
293  ic->count++;
294  }
295  if (filename) {
296  I->filename = NEW(strlen(filename)+1, char);
297  strcpy(I->filename, filename);
298  }
299  if (fullname) {
300  I->fullname = NEW(strlen(fullname)+1, char);
301  strcpy(I->fullname, fullname);
302  }
303 
304  I->attr.page_no = options.page_no;
305  I->attr.bbox_type = options.bbox_type;
306  I->attr.dict = options.dict; /* unsafe? */
307 
308  switch (format) {
309  case IMAGE_TYPE_JPEG:
310  if (dpx_conf.verbose_level > 0)
311  MESG("[JPEG]");
312  if (jpeg_include_image(I, fp) < 0)
313  goto error;
314  I->subtype = PDF_XOBJECT_TYPE_IMAGE;
315  break;
316  case IMAGE_TYPE_JP2:
317  if (dpx_conf.verbose_level > 0)
318  MESG("[JP2]");
319  if (jp2_include_image(I, fp) < 0)
320  goto error;
321  I->subtype = PDF_XOBJECT_TYPE_IMAGE;
322  break;
323 #ifdef HAVE_LIBPNG
324  case IMAGE_TYPE_PNG:
325  if (dpx_conf.verbose_level > 0)
326  MESG("[PNG]");
327  if (png_include_image(I, fp) < 0)
328  goto error;
329  I->subtype = PDF_XOBJECT_TYPE_IMAGE;
330  break;
331 #endif
332  case IMAGE_TYPE_BMP:
333  if (dpx_conf.verbose_level > 0)
334  MESG("[BMP]");
335  if (bmp_include_image(I, fp) < 0)
336  goto error;
337  I->subtype = PDF_XOBJECT_TYPE_IMAGE;
338  break;
339  case IMAGE_TYPE_PDF:
340  if (dpx_conf.verbose_level > 0)
341  MESG("[PDF]");
342  {
343  int result = pdf_include_page(I, fp, fullname, options);
344  if (result > 0)
345  /* PDF version too recent */
346  result = ps_include_page(I, fullname, options);
347  if (result < 0)
348  goto error;
349  }
350  if (dpx_conf.verbose_level > 0)
351  MESG(",Page:%ld", I->attr.page_no);
352  I->subtype = PDF_XOBJECT_TYPE_FORM;
353  break;
354 /*
355  case IMAGE_TYPE_EPS:
356 */
357  default:
358  if (dpx_conf.verbose_level > 0)
359  MESG(format == IMAGE_TYPE_EPS ? "[PS]" : "[UNKNOWN]");
360  if (ps_include_page(I, fullname, options) < 0)
361  goto error;
362  if (dpx_conf.verbose_level > 0)
363  MESG(",Page:%ld", I->attr.page_no);
364  I->subtype = PDF_XOBJECT_TYPE_FORM;
365  }
366 
367  switch (I->subtype) {
369  sprintf(I->res_name, "Im%d", id);
370  break;
372  sprintf(I->res_name, "Fm%d", id);
373  break;
374  default:
375  ERROR("Unknown XObject subtype: %d", I->subtype);
376  goto error;
377  }
378 
379  return id;
380 
381  error:
383  return -1;
384 }
385 
386 
387 #define dpx_find_file(n,d,s) (kpse_find_pict((n)))
388 #define dpx_fopen(n,m) (MFOPEN((n),(m)))
389 #define dpx_fclose(f) (MFCLOSE((f)))
390 
391 #if defined(WIN32)
392 int utf8name_failed = 0;
393 #endif /* WIN32 */
394 
395 int
397 {
398  struct ic_ *ic = &_ic;
399  int i, id = -1;
400  pdf_ximage *I;
401  char *fullname, *f = NULL;
402  int format;
403  FILE *fp;
404 
405  for (i = 0; i < ic->count; i++) {
406  I = &ic->ximages[i];
407  if (I->filename && !strcmp(filename, I->filename)) {
408  id = i;
409  break;
410  }
411  }
412  if (id >= 0) {
413  if (I->attr.page_no == options.page_no &&
414  !pdf_compare_object(I->attr.dict, options.dict) && /* ????? */
415  I->attr.bbox_type == options.bbox_type) {
416  return id;
417  }
418  f = I->fullname;
419  }
420  if (f) {
421  /* we already have converted this file; f is the temporary file name */
422  fullname = NEW(strlen(f)+1, char);
423  strcpy(fullname, f);
424  } else {
425  /* try loading image */
426 #if defined(WIN32)
427  utf8name_failed = 0;
428 #endif /* WIN32 */
429  fullname = dpx_find_file(filename, "_pic_", "");
430 #if defined(WIN32)
431  if (!fullname && file_system_codepage != win32_codepage) {
432  int tmpcp = file_system_codepage;
433  utf8name_failed = 1;
434  file_system_codepage = win32_codepage;
435  fullname = dpx_find_file(filename, "_pic_", "");
436  file_system_codepage = tmpcp;
437  }
438 #endif /* WIN32 */
439  if (!fullname) {
440 #if defined(WIN32)
441  utf8name_failed = 0;
442 #endif /* WIN32 */
444  WARN("Image inclusion failed for \"%s\".", filename);
445  } else {
446  ERROR("Image inclusion failed for \"%s\".", filename);
447  }
448  return -1;
449  }
450  }
451 
452  fp = dpx_fopen(fullname, FOPEN_RBIN_MODE);
453  if (!fp) {
455  WARN("Error opening image file \"%s\"", fullname);
456  RELEASE(fullname);
457  } else {
458  RELEASE(fullname);
459  ERROR("Image inclusion failed for \"%s\".", filename);
460  }
461  return -1;
462  }
463  if (dpx_conf.verbose_level > 0) {
464  MESG("(Image:%s", filename);
465  if (dpx_conf.verbose_level > 1)
466  MESG("[%s]", fullname);
467  }
468 
470  switch (format) {
471  case IMAGE_TYPE_MPS:
472  if (dpx_conf.verbose_level > 0)
473  MESG("[MPS]");
475  if (id < 0) {
476  WARN("Try again with the distiller.");
478  rewind(fp);
479  } else {
480  /* Workaround for the problem reported.
481  * mps_include_page() above doesn't set I->filename...
482  */
483  I = &ic->ximages[id];
484  if (!I->filename) {
485  I->filename = NEW(strlen(filename)+1, char);
486  strcpy(I->filename, filename);
487  }
488  break;
489  }
490  default:
491  id = load_image(ident, filename, fullname, format, fp, options);
492  break;
493  }
494  dpx_fclose(fp);
495 
496  RELEASE(fullname);
497 
498  if (dpx_conf.verbose_level > 0)
499  MESG(")");
500 
501  if (id < 0) {
503  WARN("Image inclusion failed for \"%s\".", filename);
504  } else {
505  ERROR("Image inclusion failed for \"%s\".", filename);
506  }
507  }
508 
509  return id;
510 }
511 
512 int
514 {
515  struct ic_ *ic = &_ic;
516  int id = -1;
517  pdf_ximage *I;
518 
519  for (id = 0; id < ic->count; id++) {
520  I = &ic->ximages[id];
521  if (I->ident && !strcmp(ident, I->ident)) {
522  return id;
523  }
524  }
525 
526  return -1;
527 }
528 
529 /* Reference: PDF Reference 1.5 v6, pp.321--322
530  *
531  * TABLE 4.42 Additional entries specific to a type 1 form dictionary
532  *
533  * BBox rectangle (Required) An array of four numbers in the form coordinate
534  * system, giving the coordinates of the left, bottom, right,
535  * and top edges, respectively, of the form XObject's bounding
536  * box. These boundaries are used to clip the form XObject and
537  * to determine its size for caching.
538  *
539  * Matrix array (Optional) An array of six numbers specifying the form
540  * matrix, which maps form space into user space.
541  * Default value: the identity matrix [1 0 0 1 0 0].
542  */
543 void
545 {
546  info->flags = 0;
547  info->bbox.llx = 0;
548  info->bbox.lly = 0;
549  info->bbox.urx = 0;
550  info->bbox.ury = 0;
551  info->matrix.a = 1.0;
552  info->matrix.b = 0.0;
553  info->matrix.c = 0.0;
554  info->matrix.d = 1.0;
555  info->matrix.e = 0.0;
556  info->matrix.f = 0.0;
557 }
558 
559 /* Reference: PDF Reference 1.5 v6, pp.303--306
560  *
561  * TABLE 4.42 Additional entries specific to an image dictionary
562  *
563  * Width integer (Required) The width of the image, in samples.
564  *
565  * Height integer (Required) The height of the image, in samples.
566  *
567  * ColorSpace name or array
568  * (Required for images, except those that use the JPXDecode
569  * filter; not allowed for image masks) The color space in
570  * which image samples are specified. This may be any type
571  * of color space except Patter.
572  *
573  * If the image uses the JPXDecode filter, this entry is
574  * optional.
575  *
576  * BitsPerComponent integer
577  * (Required except for image masks and images that use the
578  * JPXDecode filter) The number of bits used to represent
579  * each color component. Only a single value may be specified;
580  * the number of bits is the same for all color components.
581  * Valid values are 1,2,4,8, and (in PDF1.5) 16. If ImageMask
582  * is true, this entry is optional, and if speficified, its
583  * value must be 1.
584  *
585  * If the image stream uses the JPXDecode filter, this entry
586  * is optional and ignored if present. The bit depth is
587  * determined in the process of decoding the JPEG2000 image.
588  */
589 void
591 {
592  info->flags = 0;
593  info->width = 0;
594  info->height = 0;
595  info->bits_per_component = 0;
596  info->num_components = 0;
597  info->min_dpi = 0;
598  info->xdensity = info->ydensity = 1.0;
599 }
600 
601 void
603 {
604  pdf_obj *dict;
605  ximage_info *info = image_info;
606 
608  ERROR("Image XObject must be of stream type.");
609 
610  I->subtype = PDF_XOBJECT_TYPE_IMAGE;
611 
612  I->attr.width = info->width; /* The width of the image, in samples */
613  I->attr.height = info->height; /* The height of the image, in samples */
614  I->attr.xdensity = info->xdensity;
615  I->attr.ydensity = info->ydensity;
616 
617  dict = pdf_stream_dict(resource);
618  pdf_add_dict(dict, pdf_new_name("Type"), pdf_new_name("XObject"));
619  pdf_add_dict(dict, pdf_new_name("Subtype"), pdf_new_name("Image"));
620  pdf_add_dict(dict, pdf_new_name("Width"), pdf_new_number(info->width));
621  pdf_add_dict(dict, pdf_new_name("Height"), pdf_new_number(info->height));
622  if (info->bits_per_component > 0) /* Ignored for JPXDecode filter. FIXME */
623  pdf_add_dict(dict, pdf_new_name("BitsPerComponent"),
624  pdf_new_number(info->bits_per_component));
625  if (I->attr.dict)
626  pdf_merge_dict(dict, I->attr.dict);
627 
628  if (I->ident) {
629  int error;
630 
632  if (I->reference)
633  pdf_release_obj(I->reference);
634  if (error) {
635  I->reference = pdf_ref_obj(resource);
636  } else {
637  /* Need to create object reference before closing it */
638  I->reference = pdf_names_lookup_reference(global_names, I->ident, strlen(I->ident));
639  pdf_names_close_object(global_names, I->ident, strlen(I->ident));
640  }
641  I->reserved = 0;
642  } else {
643  I->reference = pdf_ref_obj(resource);
644  }
645  pdf_release_obj(resource); /* Caller don't know we are using reference. */
646  I->resource = NULL;
647 }
648 
649 void
651 {
652  xform_info *info = form_info;
653  pdf_coord p1, p2, p3, p4;
654 
655  I->subtype = PDF_XOBJECT_TYPE_FORM;
656 
657  /* Image's attribute "bbox" here is affected by /Rotate entry of included
658  * PDF page.
659  */
660  p1.x = info->bbox.llx; p1.y = info->bbox.lly;
661  pdf_dev_transform(&p1, &info->matrix);
662  p2.x = info->bbox.urx; p1.y = info->bbox.lly;
663  pdf_dev_transform(&p2, &info->matrix);
664  p3.x = info->bbox.urx; p3.y = info->bbox.ury;
665  pdf_dev_transform(&p3, &info->matrix);
666  p4.x = info->bbox.llx; p4.y = info->bbox.ury;
667  pdf_dev_transform(&p4, &info->matrix);
668 
669  I->attr.bbox.llx = min4(p1.x, p2.x, p3.x, p4.x);
670  I->attr.bbox.lly = min4(p1.y, p2.y, p3.y, p4.y);
671  I->attr.bbox.urx = max4(p1.x, p2.x, p3.x, p4.x);
672  I->attr.bbox.ury = max4(p1.y, p2.y, p3.y, p4.y);
673 
674  if (I->ident) {
675  int error;
676 
678  if (I->reference)
679  pdf_release_obj(I->reference);
680  if (error) {
681  I->reference = pdf_ref_obj(resource);
682  } else {
683  /* Need to create object reference before closing it */
684  I->reference = pdf_names_lookup_reference(global_names, I->ident, strlen(I->ident));
685  pdf_names_close_object(global_names, I->ident, strlen(I->ident));
686  }
687  I->reserved = 0;
688  } else {
689  I->reference = pdf_ref_obj(resource);
690  }
691  pdf_release_obj(resource); /* Caller don't know we are using reference. */
692  I->resource = NULL;
693 }
694 
695 int
697 {
698  return I->attr.page_no;
699 }
700 
701 #define CHECK_ID(c,n) do {\
702  if ((n) < 0 || (n) >= (c)->count) {\
703  ERROR("Invalid XObject ID: %d", (n));\
704  }\
705 } while (0)
706 #define GET_IMAGE(c,n) (&((c)->ximages[(n)]))
707 
708 pdf_obj *
710 {
711  struct ic_ *ic = &_ic;
712  pdf_ximage *I;
713 
714  CHECK_ID(ic, id);
715 
716  I = GET_IMAGE(ic, id);
717  if (!I->reference && I->resource)
718  I->reference = pdf_ref_obj(I->resource);
719 
720  return pdf_link_obj(I->reference);
721 }
722 
723 /* called from pdfdoc.c only for late binding */
724 int
726  int subtype, void *info, pdf_obj *resource)
727 {
728  struct ic_ *ic = &_ic;
729  int id, reserved = 0;
730  pdf_ximage *I;
731 
732  if (ident) {
733  for (id = 0; id < ic->count; id++) {
734  I = &ic->ximages[id];
735  if (I->ident && !strcmp(ident, I->ident) && I->reserved) {
736  reserved = 1;
737  break;
738  }
739  }
740  }
741 
742  if (!reserved) {
743  id = ic->count;
744  if (ic->count >= ic->capacity) {
745  ic->capacity += 16;
746  ic->ximages = RENEW(ic->ximages, ic->capacity, pdf_ximage);
747  }
748  I = &ic->ximages[id];
750 
751  if (ident) {
752  I->ident = NEW(strlen(ident)+1, char);
753  strcpy(I->ident, ident);
754  }
755  ic->count++;
756  }
757 
758  switch (subtype) {
761  sprintf(I->res_name, "Im%d", id);
762  break;
765  sprintf(I->res_name, "Fm%d", id);
766  break;
767  default:
768  ERROR("Unknown XObject subtype: %d", subtype);
769  }
770 
771  return id;
772 }
773 
774 int
776 {
777  struct ic_ *ic = &_ic;
778  int id;
779  pdf_ximage *I;
780 
781  for (id = 0; id < ic->count; id++) {
782  I = &ic->ximages[id];
783  if (I->ident && !strcmp(ident, I->ident)) {
784  WARN("XObject ID \"%s\" already used!", ident);
785  return -1;
786  }
787  }
788 
789  id = ic->count;
790  if (ic->count >= ic->capacity) {
791  ic->capacity += 16;
792  ic->ximages = RENEW(ic->ximages, ic->capacity, pdf_ximage);
793  }
794 
795  I = &ic->ximages[id];
796 
798 
799  if (ident) {
800  I->ident = NEW(strlen(ident)+1, char);
801  strcpy(I->ident, ident);
802  }
804  sprintf(I->res_name, "Fm%d", id);
805  I->reserved = 1;
806  ic->count++;
807 
808  return id;
809 }
810 
811 char *
813 {
814  struct ic_ *ic = &_ic;
815  pdf_ximage *I;
816 
817  CHECK_ID(ic, id);
818 
819  I = GET_IMAGE(ic, id);
820 
821  return I->res_name;
822 }
823 
824 int
826 {
827  struct ic_ *ic = &_ic;
828  pdf_ximage *I;
829 
830  CHECK_ID(ic, id);
831 
832  I = GET_IMAGE(ic, id);
833 
834  return I->subtype;
835 }
836 
837 void
838 pdf_ximage_set_attr (int id, int width, int height, double xdensity, double ydensity, double llx, double lly, double urx, double ury)
839 {
840  struct ic_ *ic = &_ic;
841  pdf_ximage *I;
842 
843  CHECK_ID(ic, id);
844 
845  I = GET_IMAGE(ic, id);
846  I->attr.width = width;
847  I->attr.height = height;
848  I->attr.xdensity = xdensity;
849  I->attr.ydensity = ydensity;
850  I->attr.bbox.llx = llx;
851  I->attr.bbox.lly = lly;
852  I->attr.bbox.urx = urx;
853  I->attr.bbox.ury = ury;
854 }
855 
856 /* depth...
857  * Dvipdfm treat "depth" as "yoffset" for pdf:image and pdf:uxobj
858  * not as vertical dimension of scaled image. (And there are bugs.)
859  * This part contains incompatibile behaviour than dvipdfm!
860  */
861 #define EBB_DPI 72
862 
863 static void
865  transform_info *p,
866  pdf_ximage *I)
867 {
868  double s_x, s_y, d_x, d_y;
869  double wd0, ht0, dp, xscale, yscale;
870 
871  if (p->flags & INFO_HAS_USER_BBOX) {
872  wd0 = p->bbox.urx - p->bbox.llx;
873  ht0 = p->bbox.ury - p->bbox.lly;
874  xscale = I->attr.width * I->attr.xdensity / wd0;
875  yscale = I->attr.height * I->attr.ydensity / ht0;
876  d_x = -p->bbox.llx / wd0;
877  d_y = -p->bbox.lly / ht0;
878  } else {
879  wd0 = I->attr.width * I->attr.xdensity;
880  ht0 = I->attr.height * I->attr.ydensity;
881  xscale = yscale = 1.0;
882  d_x = 0.0;
883  d_y = 0.0;
884  }
885 
886  if (wd0 == 0.0) {
887  WARN("Image width=0.0!");
888  wd0 = 1.0;
889  }
890  if (ht0 == 0.0) {
891  WARN("Image height=0.0!");
892  ht0 = 1.0;
893  }
894 
895  if ( (p->flags & INFO_HAS_WIDTH ) &&
896  (p->flags & INFO_HAS_HEIGHT) ) {
897  s_x = p->width * xscale;
898  s_y = (p->height + p->depth) * yscale;
899  dp = p->depth * yscale;
900  } else if ( p->flags & INFO_HAS_WIDTH ) {
901  s_x = p->width * xscale;
902  s_y = s_x * ((double)I->attr.height / I->attr.width);
903  dp = 0.0;
904  } else if ( p->flags & INFO_HAS_HEIGHT) {
905  s_y = (p->height + p->depth) * yscale;
906  s_x = s_y * ((double)I->attr.width / I->attr.height);
907  dp = p->depth * yscale;
908  } else {
909  s_x = wd0;
910  s_y = ht0;
911  dp = 0.0;
912  }
913  T->a = s_x; T->c = 0.0;
914  T->b = 0.0; T->d = s_y;
915  T->e = d_x * s_x / xscale; T->f = d_y * s_y / yscale - dp;
916 
917  return;
918 }
919 
920 
921 static void
923  transform_info *p,
924  pdf_ximage *I)
925 {
926  double s_x, s_y, d_x, d_y;
927  double wd0, ht0, dp;
928 
929  if (p->flags & INFO_HAS_USER_BBOX) {
930  wd0 = p->bbox.urx - p->bbox.llx;
931  ht0 = p->bbox.ury - p->bbox.lly;
932  d_x = -p->bbox.llx;
933  d_y = -p->bbox.lly;
934  } else {
935  wd0 = I->attr.bbox.urx - I->attr.bbox.llx;
936  ht0 = I->attr.bbox.ury - I->attr.bbox.lly;
937  d_x = 0.0;
938  d_y = 0.0;
939  }
940 
941  if (wd0 == 0.0) {
942  WARN("Image width=0.0!");
943  wd0 = 1.0;
944  }
945  if (ht0 == 0.0) {
946  WARN("Image height=0.0!");
947  ht0 = 1.0;
948  }
949 
950  if ( (p->flags & INFO_HAS_WIDTH ) &&
951  (p->flags & INFO_HAS_HEIGHT) ) {
952  s_x = p->width / wd0;
953  s_y = (p->height + p->depth) / ht0;
954  dp = p->depth;
955  } else if ( p->flags & INFO_HAS_WIDTH ) {
956  s_x = p->width / wd0;
957  s_y = s_x;
958  dp = 0.0;
959  } else if ( p->flags & INFO_HAS_HEIGHT) {
960  s_y = (p->height + p->depth) / ht0;
961  s_x = s_y;
962  dp = p->depth;
963  } else {
964  s_x = s_y = 1.0;
965  dp = 0.0;
966  }
967 
968  T->a = s_x; T->c = 0.0;
969  T->b = 0.0; T->d = s_y;
970  T->e = s_x * d_x; T->f = s_y * d_y - dp;
971 
972  return;
973 }
974 
975 
976 /* called from pdfdev.c and spc_html.c */
977 int
979  pdf_tmatrix *M, /* return value for trans matrix */
980  pdf_rect *r, /* return value for clipping */
981  transform_info *p /* argument from specials */
982  )
983 {
984  struct ic_ *ic = &_ic;
985  pdf_ximage *I;
986 
987  CHECK_ID(ic, id);
988 
989  I = GET_IMAGE(ic, id);
990 
991  pdf_setmatrix(M, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0);
992 
993  switch (I->subtype) {
994  /* Reference: PDF Reference 1.5 v6, p.302
995  *
996  * An image can be placed on the output page in any desired position,
997  * orientation, and size by using the cm operator to modify the current
998  * transformation matrix (CTM) so as to map the unit square of user space
999  * to the rectangle or parallelogram in which the image is to be painted.
1000  *
1001  * There is neither BBox nor Matrix key in the image XObject.
1002  * Everything must be controlled by the cm operator.
1003  *
1004  * The argument [p] contains the user-defined bounding box, the scailing
1005  * factor of which is bp as EPS and PDF. On the other hand, I->attr
1006  * contains the (sampling) width and the (sampling) height of the image.
1007  *
1008  * There is no problem if a bitmap image has density information.
1009  * Otherwise, DVIPDFM's ebb generates bounding box as 100px = 72bp = 1in.
1010  * In this case, screen captured images look bad. Moreover, DVIPDFM's ebb
1011  * ignores all density information and use just 100px = 72bp = 1in.
1012  *
1013  * On the other hand, pdfTeX uses 100px = 100bp to get a better quality
1014  * for screen captured images.
1015  *
1016  * DVIPDFMx's xbb generates bounding box as 100px = 100bp in the same
1017  * way as pdfTeX. Furthermore, it takes care of density information too.
1018  */
1020  scale_to_fit_I(M, p, I);
1021  if (p->flags & INFO_HAS_USER_BBOX) {
1022  r->llx = p->bbox.llx / (I->attr.width * I->attr.xdensity);
1023  r->lly = p->bbox.lly / (I->attr.height * I->attr.ydensity);
1024  r->urx = p->bbox.urx / (I->attr.width * I->attr.xdensity);
1025  r->ury = p->bbox.ury / (I->attr.height * I->attr.ydensity);
1026  } else {
1027  r->llx = 0.0;
1028  r->lly = 0.0;
1029  r->urx = 1.0;
1030  r->ury = 1.0;
1031  }
1032  break;
1033  /* User-defined transformation and clipping are controlled by
1034  * the cm operator and W operator, explicitly */
1035  case PDF_XOBJECT_TYPE_FORM:
1036  scale_to_fit_F(M, p, I);
1037  if (p->flags & INFO_HAS_USER_BBOX) {
1038  r->llx = p->bbox.llx;
1039  r->lly = p->bbox.lly;
1040  r->urx = p->bbox.urx;
1041  r->ury = p->bbox.ury;
1042  } else { /* I->attr.bbox from the image bounding box */
1043  r->llx = I->attr.bbox.llx;
1044  r->lly = I->attr.bbox.lly;
1045  r->urx = I->attr.bbox.urx;
1046  r->ury = I->attr.bbox.ury;
1047  }
1048  break;
1049  default: /* maybe reserved */
1050  if (p->flags & INFO_HAS_USER_BBOX) {
1051  r->llx = p->bbox.llx;
1052  r->lly = p->bbox.lly;
1053  r->urx = p->bbox.urx;
1054  r->ury = p->bbox.ury;
1055  } else { /* I->attr.bbox from the image bounding box */
1056  r->llx = 0.0;
1057  r->lly = 0.0;
1058  r->urx = 1.0;
1059  r->ury = 1.0;
1060  }
1061  }
1062 
1063  return 0;
1064 }
1065 
1066 
1067 /* Migrated from psimage.c */
1068 
1070 {
1071  if (_opts.cmdtmpl)
1073  if (!s || *s == '\0')
1074  _opts.cmdtmpl = NULL;
1075  else {
1076  _opts.cmdtmpl = NEW(strlen(s) + 1, char);
1077  strcpy(_opts.cmdtmpl, s);
1078  }
1079  return;
1080 }
1081 
1083 {
1084  return _opts.cmdtmpl;
1085 }
1086 
1087 static int
1089 {
1091  char *temp;
1092  FILE *fp;
1093  int error = 0;
1094  struct stat stat_o, stat_t;
1095 
1096  if (!distiller_template) {
1097  WARN("No image converter available for converting file \"%s\" to PDF format.", filename);
1098  WARN(">> Please check if you have 'D' option in config file.");
1099  return -1;
1100  }
1101 
1103  if (!temp) {
1104  WARN("Failed to create temporary file for image conversion: %s", filename);
1105  return -1;
1106  }
1107 
1108 #ifdef MIKTEX
1109  {
1110  char *p;
1111  for (p = (char *)filename; *p; p++) {
1112  if (*p == '\\') *p = '/';
1113  }
1114  for (p = (char *)temp; *p; p++) {
1115  if (*p == '\\') *p = '/';
1116  }
1117  }
1118 #endif
1119 
1120 #if defined(_WIN32)
1121 /* temp is always ASCII only. So fsyscp_stat() is not necessary for
1122  * temp. However, filename can be non-ASCII UTF-8.
1123  */
1124  if (dpx_conf.file.keep_cache != -1 &&
1125  stat(temp, &stat_t)==0 &&
1126  (fsyscp_stat(filename, &stat_o)==0 ||
1127  stat(filename, &stat_o)==0) &&
1128  stat_t.st_mtime > stat_o.st_mtime) {
1129 #else
1130  if (dpx_conf.file.keep_cache != -1 &&
1131  stat(temp, &stat_t)==0 && stat(filename, &stat_o)==0 &&
1132  stat_t.st_mtime > stat_o.st_mtime) {
1133 #endif /* _WIN32 */
1134  /* cache exist */
1135  /*printf("\nLast file modification: %s", ctime(&stat_o.st_mtime));
1136  printf("Last file modification: %s", ctime(&stat_t.st_mtime));*/
1137  ;
1138  } else {
1139  if (dpx_conf.verbose_level > 1) {
1140  MESG("\n");
1141  MESG("pdf_image>> Converting file \"%s\" --> \"%s\" via:\n", filename, temp);
1142  MESG("pdf_image>> %s\n", distiller_template);
1143  MESG("pdf_image>> ...");
1144  }
1146  pdf_get_version());
1147  if (error) {
1148  WARN("Image format conversion for \"%s\" failed...", filename);
1149  dpx_delete_temp_file(temp, true);
1150  return error;
1151  }
1152  }
1153 
1155  if (!fp) {
1156  WARN("Could not open conversion result \"%s\" for image \"%s\". Why?", temp, filename);
1157  dpx_delete_temp_file(temp, true);
1158  return -1;
1159  }
1160  pdf_set_ximage_tempfile(ximage, temp);
1161  error = pdf_include_page(ximage, fp, temp, options);
1162  MFCLOSE(fp);
1163 
1164  /* See pdf_close_images for why we cannot delete temporary files here. */
1165 
1166  RELEASE(temp);
1167 
1168  if (error) {
1169  WARN("Failed to include image file \"%s\"", filename);
1170  WARN(">> Please check if");
1171  WARN(">> %s", distiller_template);
1172  WARN(">> %%o = output filename, %%i = input filename, %%b = input filename without suffix");
1173  WARN(">> can really convert \"%s\" to PDF format image.", filename);
1174  }
1175 
1176  return error;
1177 }
1178 
1179 static int check_for_ps (FILE *image_file)
1180 {
1181  rewind (image_file);
1182  mfgets (work_buffer, WORK_BUFFER_SIZE, image_file);
1183  if (!strncmp (work_buffer, "%!", 2))
1184  return 1;
1185  return 0;
1186 }
1187 
1188 static int check_for_mp (FILE *image_file)
1189 {
1190  int try_count = 10;
1191 
1192  rewind (image_file);
1193  mfgets(work_buffer, WORK_BUFFER_SIZE, image_file);
1194  if (strncmp(work_buffer, "%!PS", 4))
1195  return 0;
1196 
1197  while (try_count > 0) {
1198  mfgets(work_buffer, WORK_BUFFER_SIZE, image_file);
1199  if (!strncmp(work_buffer, "%%Creator:", 10)) {
1200  if (strlen(work_buffer+10) >= 8 &&
1201  strstr(work_buffer+10, "MetaPost"))
1202  break;
1203  }
1204  try_count--;
1205  }
1206 
1207  return ((try_count > 0) ? 1 : 0);
1208 }
1209 
1210 /* ERROR() can't be used here otherwise the cleanup routine is recursively called. */
1211 #undef ERROR
1212 void
1214 {
1215  struct ic_ *ic = &_ic;
1216  int i;
1217  pdf_ximage *I;
1218 
1219  for (i = 0; i < ic->count; i++) {
1220  I = &ic->ximages[i];
1221  if (I->attr.tempfile) {
1222  dpx_delete_temp_file(I->fullname, false); /* temporary filename freed here */
1223  }
1224  }
1225 }
double ury
Definition: aftopl.c:56
double urx
Definition: aftopl.c:55
double lly
Definition: aftopl.c:54
double llx
Definition: aftopl.c:53
#define width(a)
Definition: aptex-macros.h:198
#define subtype(a)
Definition: aptex-macros.h:172
#define height(a)
Definition: aptex-macros.h:200
char * p2
Definition: bmpfont.h:62
char * p1
Definition: bmpfont.h:62
static int id
Definition: bifont.c:66
#define FOPEN_RBIN_MODE
Definition: dvips.h:86
int strcmp()
Definition: coll.cpp:143
char * strcpy()
char * temp
Definition: dvidvi.c:137
#define info
Definition: dviinfo.c:42
#define error(a)
Definition: dviinfo.c:48
#define T
Definition: fmt.h:20
mpz_t * f
Definition: gen-fib.c:34
#define s
Definition: afcover.h:80
const unsigned M
Definition: image.cpp:28
#define NULL
Definition: ftobjs.h:61
small capitals from c petite p
Definition: afcover.h:72
small capitals from c petite p scientific i
Definition: afcover.h:80
#define I(x, y, z)
Definition: md5.c:55
#define NEW
Definition: gdkanji.c:77
int bmp_include_image(pdf_ximage *ximage, FILE *fp)
Definition: bmpimage.c:121
int check_for_bmp(FILE *fp)
Definition: bmpimage.c:74
struct _dpx_conf dpx_conf
Definition: dpxconf.c:33
@ dpx_mode_compat_mode
Definition: dpxconf.h:28
char * dpx_create_fix_temp_file(const char *filename)
Definition: dpxfile.c:949
void dpx_delete_temp_file(char *tmp, int force)
Definition: dpxfile.c:1048
int dpx_file_apply_filter(const char *cmdtmpl, const char *input, const char *output, int version)
Definition: dpxfile.c:1066
double min4(double x1, double x2, double x3, double x4)
Definition: dpxutil.c:53
double max4(double x1, double x2, double x3, double x4)
Definition: dpxutil.c:63
int pdf_include_page(pdf_ximage *ximage, FILE *image_file, const char *ident, load_options options)
Definition: epdf.c:113
void WARN(const char *fmt,...)
Definition: error.c:62
void MESG(const char *fmt,...)
Definition: error.c:49
int check_for_jp2(FILE *fp)
Definition: jp2image.c:339
int jp2_include_image(pdf_ximage *ximage, FILE *fp)
Definition: jp2image.c:363
int jpeg_include_image(pdf_ximage *ximage, FILE *fp)
Definition: jpegimage.c:228
int check_for_jpeg(FILE *fp)
Definition: jpegimage.c:214
#define RENEW(p, n, type)
Definition: mem.h:38
#define RELEASE(p)
Definition: mem.h:39
char * mfgets(char *buffer, int length, FILE *file)
Definition: mfileio.c:132
char work_buffer[1024]
Definition: mfileio.c:171
#define WORK_BUFFER_SIZE
Definition: mfileio.h:68
#define MFOPEN(name, mode)
Definition: mfileio.h:42
#define MFCLOSE(file)
Definition: mfileio.h:44
int mps_include_page(const char *ident, FILE *fp)
Definition: mpost.c:1544
#define INFO_HAS_HEIGHT
Definition: pdfdev.h:71
#define INFO_HAS_USER_BBOX
Definition: pdfdev.h:69
#define INFO_HAS_WIDTH
Definition: pdfdev.h:70
struct ht_table * global_names
Definition: pdfdoc.c:101
void pdf_dev_transform(pdf_coord *p, const pdf_tmatrix *M)
Definition: pdfdraw.c:1749
#define pdf_setmatrix(m, p, q, r, s, t, u)
Definition: pdfdraw.h:41
pdf_obj * pdf_names_lookup_reference(struct ht_table *names, const void *key, int keylen)
Definition: pdfnames.c:217
int pdf_names_close_object(struct ht_table *names, const void *key, int keylen)
Definition: pdfnames.c:263
pdf_obj * pdf_names_reserve(struct ht_table *names, const void *key, int keylen)
Definition: pdfnames.c:179
int pdf_names_add_object(struct ht_table *names, const void *key, int keylen, pdf_obj *object)
Definition: pdfnames.c:145
pdf_obj * pdf_new_name(const char *name)
Definition: pdfobj.c:1330
int pdf_compare_object(pdf_obj *obj1, pdf_obj *obj2)
Definition: pdfobj.c:4522
pdf_obj * pdf_new_number(double value)
Definition: pdfobj.c:1076
pdf_obj * pdf_ref_obj(pdf_obj *object)
Definition: pdfobj.c:960
void pdf_release_obj(pdf_obj *object)
Definition: pdfobj.c:3217
int check_for_pdf(FILE *file)
Definition: pdfobj.c:4346
void pdf_merge_dict(pdf_obj *dict1, pdf_obj *dict2)
Definition: pdfobj.c:1763
pdf_obj * pdf_stream_dict(pdf_obj *stream)
Definition: pdfobj.c:2374
pdf_obj * pdf_link_obj(pdf_obj *object)
Definition: pdfobj.c:948
int pdf_get_version(void)
Definition: pdfobj.c:395
int pdf_add_dict(pdf_obj *dict, pdf_obj *key, pdf_obj *value)
Definition: pdfobj.c:1680
#define PDF_OBJ_STREAMTYPE(o)
Definition: pdfobj.h:84
int pdf_ximage_get_page(pdf_ximage *I)
Definition: pdfximage.c:696
int pdf_ximage_defineresource(const char *ident, int subtype, void *info, pdf_obj *resource)
Definition: pdfximage.c:725
void pdf_ximage_set_attr(int id, int width, int height, double xdensity, double ydensity, double llx, double lly, double urx, double ury)
Definition: pdfximage.c:838
int pdf_ximage_scale_image(int id, pdf_tmatrix *M, pdf_rect *r, transform_info *p)
Definition: pdfximage.c:978
void pdf_init_images(void)
Definition: pdfximage.c:178
int pdf_ximage_reserve(const char *ident)
Definition: pdfximage.c:775
void pdf_ximage_set_image(pdf_ximage *I, void *image_info, pdf_obj *resource)
Definition: pdfximage.c:602
void set_distiller_template(char *s)
Definition: pdfximage.c:1069
pdf_obj * pdf_ximage_get_reference(int id)
Definition: pdfximage.c:709
void pdf_ximage_set_form(pdf_ximage *I, void *form_info, pdf_obj *resource)
Definition: pdfximage.c:650
char * pdf_ximage_get_resname(int id)
Definition: pdfximage.c:812
int pdf_ximage_load_image(const char *ident, const char *filename, load_options options)
Definition: pdfximage.c:396
int pdf_ximage_findresource(const char *ident)
Definition: pdfximage.c:513
char * get_distiller_template(void)
Definition: pdfximage.c:1082
void pdf_error_cleanup_cache(void)
Definition: pdfximage.c:1213
void pdf_close_images(void)
Definition: pdfximage.c:187
void pdf_ximage_init_form_info(xform_info *info)
Definition: pdfximage.c:544
void pdf_ximage_init_image_info(ximage_info *info)
Definition: pdfximage.c:590
int pdf_ximage_get_subtype(int id)
Definition: pdfximage.c:825
#define PDF_XOBJECT_TYPE_FORM
Definition: pdfximage.h:29
#define PDF_XOBJECT_TYPE_IMAGE
Definition: pdfximage.h:30
static char * distiller_template
Definition: spc_dvips.c:284
#define ERROR(string)
Definition: error.h:36
int check_for_png(FILE *png_file)
Definition: pngimage.c:39
char * strstr()
int stat(const char *path, struct stat *sbuf)
int strncmp()
#define sprintf
Definition: snprintf.c:44
static int format
Definition: pbmclean.c:15
char * filename[256]
Definition: pbmtopk.c:46
#define fp
int r
Definition: ppmqvga.c:68
static double yscale
Definition: ppmtopjxl.c:47
static double xscale
Definition: ppmtopjxl.c:46
bstring c int memset(void *s, int c, int length)
@ reserved
Definition: Pass.cpp:50
#define IMAGE_TYPE_JPEG
Definition: pdfximage.c:59
#define dpx_find_file(n, d, s)
Definition: pdfximage.c:387
#define CHECK_ID(c, n)
Definition: pdfximage.c:701
static void scale_to_fit_I(pdf_tmatrix *T, transform_info *p, pdf_ximage *I)
Definition: pdfximage.c:864
#define dpx_fopen(n, m)
Definition: pdfximage.c:388
static void pdf_clean_ximage_struct(pdf_ximage *I)
Definition: pdfximage.c:159
static void scale_to_fit_F(pdf_tmatrix *T, transform_info *p, pdf_ximage *I)
Definition: pdfximage.c:922
#define IMAGE_TYPE_PNG
Definition: pdfximage.c:60
static struct ic_ _ic
Definition: pdfximage.c:118
#define IMAGE_TYPE_UNKNOWN
Definition: pdfximage.c:57
#define GET_IMAGE(c, n)
Definition: pdfximage.c:706
#define IMAGE_TYPE_JP2
Definition: pdfximage.c:64
static void pdf_set_ximage_tempfile(pdf_ximage *I, const char *fullname)
Definition: pdfximage.c:149
static int source_image_type(FILE *fp)
Definition: pdfximage.c:222
static int check_for_ps(FILE *image_file)
Definition: pdfximage.c:1179
#define IMAGE_TYPE_BMP
Definition: pdfximage.c:63
#define IMAGE_TYPE_EPS
Definition: pdfximage.c:62
static int ps_include_page(pdf_ximage *ximage, const char *ident, load_options options)
Definition: pdfximage.c:1088
#define IMAGE_TYPE_PDF
Definition: pdfximage.c:58
#define dpx_fclose(f)
Definition: pdfximage.c:389
static int check_for_mp(FILE *image_file)
Definition: pdfximage.c:1188
static int load_image(const char *ident, const char *filename, const char *fullname, int format, FILE *fp, load_options options)
Definition: pdfximage.c:263
static void pdf_init_ximage_struct(pdf_ximage *I)
Definition: pdfximage.c:123
static struct opt_ _opts
Definition: pdfximage.c:108
#define IMAGE_TYPE_MPS
Definition: pdfximage.c:61
RETTYPE mp_ptr mp_size_t mp_srcptr dp
Definition: sec_div.c:70
int verbose_level
Definition: dpxconf.h:35
struct _dpx_conf::@127 file
int keep_cache
Definition: dpxconf.h:39
enum dpx_mode compat_mode
Definition: dpxconf.h:36
int page_no
Definition: pdfximage.c:77
int width
Definition: pdfximage.c:72
char tempfile
Definition: pdfximage.c:81
int height
Definition: pdfximage.c:72
double xdensity
Definition: pdfximage.c:73
double ydensity
Definition: pdfximage.c:73
int page_count
Definition: pdfximage.c:78
pdf_obj * dict
Definition: pdfximage.c:80
int bbox_type
Definition: pdfximage.c:79
pdf_rect bbox
Definition: pdfximage.c:74
Definition: utils.c:300
Definition: pdfximage.c:113
int count
Definition: pdfximage.c:114
pdf_ximage * ximages
Definition: pdfximage.c:115
int capacity
Definition: pdfximage.c:114
char * cmdtmpl
Definition: pdfximage.c:105
Definition: tpic.c:45
double y
Definition: pdfdev.h:46
double x
Definition: pdfdev.h:46
Definition: pdfobj.c:63
pdf_obj * resource
Definition: pdfximage.c:96
int subtype
Definition: pdfximage.c:89
char * filename
Definition: pdfximage.c:93
char * fullname
Definition: pdfximage.c:94
struct attr_ attr
Definition: pdfximage.c:91
pdf_obj * reference
Definition: pdfximage.c:95
char * ident
Definition: pdfximage.c:86
char res_name[16]
Definition: pdfximage.c:87
int reserved
Definition: pdfximage.c:98
#define FILE
Definition: t1stdio.h:34
*job_name strlen((char *) job_name) - 4)
char ident[]
Definition: ttf2pk.c:40