[DVIPDFMx] [PATCH] pdf:fstream not working
Alexander Grahn
A.Grahn at hzdr.de
Thu Mar 8 20:53:55 KST 2012
On Thu, Mar 08, 2012 at 10:05:28AM +0100, Alexander Grahn wrote:
>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
Improved patch. Issues warning if file was not found.
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 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);
More information about the dvipdfmx
mailing list