[DVIPDFMx] dvipdfmx patch

Alexander Grahn A.Grahn at hzdr.de
Fri Mar 30 16:02:57 KST 2012


Hi all!
On Thu, Mar 29, 2012 at 04:12:17PM -0700, Karl Berry wrote:
>ChoF, Matthias,
>
>Wdyt of the below?  Seems pretty straightforward.
>
>Do you think you'll be able to put together a new dvipdfmx release for
>TL'12?  If not, would it be ok if we just install this in the TL sources
>for this release, until you do have time?
>
>Thanks,
>Karl
>
>
>Date: Wed, 21 Mar 2012 13:59:05 +0100
>From: Alexander Grahn <A.Grahn at hzdr.de>
>To: <tex-live at tug.org>
>Subject: [tex-live] dvipdfmx still alive?
>
>[...]
>a while ago I proposed a patch on the dvipdfmx mailing list which solves the
>broken pdf:fstream issue.  It was first reported here
>
>http://tug.org/mailman/htdig/tex-live/2010-September/027379.html
>
>Unlike the pdftex counterpart
>  \pdfobj stream file {...}
>
>and the dvipdfmx pdf special
>  pdf:image
>
>which both find files in the current directory and in the TeX search path
>(TEXINPUTS, fndb),
>  pdf:fstream
>
>wants an absolute path plus file name, otherwise the file cannot be
>found.  The patch makes pdf:fstream behave like pdf:image as for locating
>files.
>
>[...]
>
>This is the current version of the patch, the first one I sent had some
>deficiencies. Thanks for taking it into considration.
>
>Alexander
>
>--- dvipdfmx-20110311/src/spc_pdfm.c	2011-03-08 03:08:35.000000000 +0100
>+++ dvipdfmx-20110311/src/spc_pdfm.c.new	2012-03-08 12:48:48.000000000 +0100
>@@ -1364,7 +1364,7 @@
> {
>   pdf_obj *fstream;
>   long     nb_read;
>-  char    *ident, *instring;
>+  char    *ident, *instring, *fullname;
>   pdf_obj *tmp;
>   FILE    *fp;
> 
>@@ -1400,11 +1400,19 @@
>       RELEASE(ident);
>       return  -1;
>     }
>-    fp = DPXFOPEN(instring, DPX_RES_TYPE_BINARY);
>+    fullname = kpse_find_pict(instring);
>+    if (!fullname) {
>+      spc_warn(spe, "File \"%s\" not found.", instring);
>+      pdf_release_obj(tmp);
>+      RELEASE(ident);
>+      return  -1;
>+    }
>+    fp = DPXFOPEN(fullname, DPX_RES_TYPE_BINARY);
>     if (!fp) {
>       spc_warn(spe, "Could not open file: %s", instring);
>       pdf_release_obj(tmp);
>       RELEASE(ident);
>+      RELEASE(fullname);
>       return -1;
>     }
>     fstream = pdf_new_stream(STREAM_COMPRESS);

Here is a small TeX file for testing. It creates two file attachments.
The first one is made from article.cls, found in the fndb, the second one from the TeX file itself.

Alexander

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
text.
\special{pdf:fstream @obj1 (article.cls)}%
\special{pdf:ann bbox 0 0 10 10 <<
  /Subtype /FileAttachment /FS <<
    /Type /Filespec /F (article.cls)
      /EF << /F @obj1 >> >>
  /Name /PushPin >>}
\vskip 1in
\special{pdf:fstream @obj2 (\jobname.tex)}%
\special{pdf:ann bbox 0 0 10 10 <<
  /Subtype /FileAttachment /FS <<
    /Type /Filespec /F (\jobname.tex)
      /EF << /F @obj2 >> >>
  /Name /PushPin >>}
\bye
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


More information about the dvipdfmx mailing list