[tex-live] bug in attachfile.sty

Tigran Aivazian tigran at aivazian.fsnet.co.uk
Thu Oct 28 13:26:17 CEST 2004


Hello,

I haven't heard from Scott Pakin about this bug, so I am forwarding to a 
wider audience in hope that someone knows how to correctly set mimetype in 
\attachfile (i.e. /Subtype value of /EmbeddedFile attachment).

More generically, how would one propagate a TeX string containing slash 
"/" into a PDF string? Trying to do something like this:

\pdfstringdef{\textp}{text\#2Fplain}

ends up with the value /text\0432Fplain in the PDF file which is not what 
we want.

Also, the reason I am emailing tex-live is because TeX Live includes 
attachfile package and the email below contains a simple bugfix (/Subtype 
is a name and not a string according to the PDF spec).

Kind regards
Tigran

---------- Forwarded message ----------
Date: Sun, 24 Oct 2004 22:16:12 +0100 (BST)
From: Tigran Aivazian <tigran at bibles.org.uk>
To: Scott Pakin <pakin at uiuc.edu>
Subject: bug in attachfile.sty

Hello Scott,

I am using your attachfile package and am very happy with it.

However, there is a small glitch in the way it handles the 'mimetypes' setup 
option. For example, if I write:

attachfilesetup{%
         description={Tiqwah source code},%
         mimetype={text/plain},%
         print={false},%
         author={Tigran Aivazian},%
         timezone={Z}% Z means GMT.
}

The resulting PDF file contains the following object:

7 0 obj <<
  /Type /EmbeddedFile /Subtype (text/plain)
/Length 35
/Filter /FlateDecode
>>

i.e. it handles /Subtype as a string. But the PDF spec says it is a name, and 
looking at a PDF file with attachment created by Adobe Acrobat I see /Subtype 
values like this:

/Subtype /application#2Foctet-stream

Now, if I modify your package as follows:

@@ -245,7 +245,7 @@
  \def\atfi at mimetype{}
  \define at key{AtFi}{mimetype}{%
    \atfi at pdfstringdef\atfi at mimetype{#1}%
-  \edef\atfi at mimetype{/Subtype (\atfi at mimetype)}%
+  \edef\atfi at mimetype{/Subtype /\atfi at mimetype}%
  }
  \define at key{AtFi}{icon}{%
    \def\atfi at icon{/Name /#1}%

then the mimetypes value will be stored as a name, but it is very difficult to 
set the value '/' in there.

I tried mimetypes=text\#2Fplain, but I end up with
/Subtype /text\0432Fplain which is wrong.

Can you please tell me how to set the slash in "text/plain" correctly?
And is the above fix to attachfile.sty correct or do you have a proper fix?

Kind regards
Tigran

=========
http://www.bibles.org.uk/pdf/bibles (both tnk.pdf and HebrewNT.pdf use 
attachfile to embed their own source code in the PDF files)



More information about the tex-live mailing list