[DVIPDFMx] [PATCH] pdf:fstream not working

Alexander Grahn A.Grahn at hzdr.de
Thu Mar 8 18:05:28 KST 2012


Hi ChoF,

On Wed, Aug 24, 2011 at 09:19:05AM +0200, Alexander Grahn wrote:
>Dear ChoF,
>
>On Thu, Apr 28, 2011 at 09:24:10PM +0900, Jin-Hwan CHO wrote:
>>You were right, Alexander. The version 20100328 (and xdvipdfmx too)
>>had the problem.
>>I tried the following code with the recent version of dvipdfmx but
>>there were no error.
>>
>>text
>>\special{pdf:fstream @obj1 (somefile.txt)}
>>\special{pdf:ann bbox 0 0 10 10 <<
>>  /Subtype /FileAttachment /FS <<
>>    /Type /Filespec /F (somefile.txt)
>>      /EF << /F @obj1 >> >>
>>  /Name /PushPin >>}
>>\bye
>>
>>Let me know if I can give you any help for your package.
>
>I ran dvipdfmx-20110311 (TeXLive-2011) on your test file and the same
>error
>
>  [1
>  ** WARNING ** Could not open file: somefile.txt
>  ** WARNING ** Interpreting special command fstream (pdf:) failed.
>  ** WARNING ** >> at page="1" position="(112.681, 759.927)" (in PDF)
>  ** WARNING ** >> xxx "pdf:fstream @obj1 (somefile.txt)"
>  ]
>  ** WARNING ** Object @obj1 used, but not defined. Replaced by null.
>  
>and the unrelated but non-fatal
>  
>  ** WARNING ** 1 memory objects still allocated
>
>still occur. The same result with XeTeX. Probably you tested a newer
>(svn) version than the one marked for TeXLive-2011 inclusion.
>

The attached patch against the 20110311 sources fixes the problem. Would
you please apply it?

It makes the `fstream' special behave like the `image' special as to
searching files. Files in the working directory and in the TEXMF trees
will be found. No more need for absolute paths.

Thanks in advance and kind regards,
Alexander
-------------- next part --------------
--- dvipdfmx-20110311/src/spc_pdfm.c	2011-03-08 03:08:35.000000000 +0100
+++ dvipdfmx-20110311/src/spc_pdfm.c.new	2012-03-08 09:21:18.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,7 +1400,11 @@
       RELEASE(ident);
       return  -1;
     }
-    fp = DPXFOPEN(instring, DPX_RES_TYPE_BINARY);
+/*  Segmentation fault
+    fullname = kpse_find_file(instring, kpse_program_binary_format, true);
+*/    
+    fullname = kpse_find_pict(instring);
+    fp = DPXFOPEN(fullname, DPX_RES_TYPE_BINARY);
     if (!fp) {
       spc_warn(spe, "Could not open file: %s", instring);
       pdf_release_obj(tmp);


More information about the dvipdfmx mailing list