title: Creating a PDF file containing a clickable file attachment
body: <p>I'm trying to revive some old code that creates a PDF file directly (not using any API). It is pretty simple, just some plain text, followed by one or more attachments. I'm trying to make it so when a reader clicks on the attachment name, Windows will open the corresponding application using that file.</p>
  <p>I'm certain that this used to work, however now it does not.  When hovering over the attachment name, the cursor turns to a hand, and clicking causes the area to highlight, but the application does not start - nothing happens.</p>
  <p>I was thinking the problem is enhanced security in Adobe Reader, but that does not seem to be true. I have turned off all security, and the checkbox &quot;Allow opening of non-PDF file attachments with external applications&quot; is enabled.</p>
  <p>So is my PDF formatting code incorrect now? Below is the entirety of a very simple file. The attachment should be located in c:\temp2\pdf\PDF Attachments\ewsmeet.txt. If someone could look at this and tell me what the problem is, I would very much appreciate it.</p>
  <pre><code>%PDF-1.4
  %âãÏÓ
  1 0 obj
  &lt;&lt; /Type /Font
  /Subtype /Type1
  /Name /F1
  /BaseFont /Helvetica
  /Encoding /WinAnsiEncoding
  &gt;&gt;
  endobj
  2 0 obj
  &lt;&lt; /Type /Font
  /Subtype /Type1
  /Name /F2
  /BaseFont /Courier-Bold
  /Encoding /WinAnsiEncoding
  &gt;&gt;
  endobj
  3 0 obj
  &lt;&lt; /Type /Font
  /Subtype /Type1
  /Name /F3
  /BaseFont /Times-Roman
  /Encoding /WinAnsiEncoding
  &gt;&gt;
  endobj
  4 0 obj
  [/PDF /Text]
  endobj
  5 0 obj
  &lt;&lt; /Length 184 &gt;&gt;
  stream
  BT
  /F1 12 Tf
  10 750 Td
  14 TL
  (This is dummy text.) '
  /F3 12 Tf
  () '
  /F1 12 Tf
  (_______________________________________________________) '
  () '
  /F2 12 Tf
  (Attachment: ewsmeet.txt) '
  ET
  endstream
  endobj
  6 0 obj
  &lt;&lt;
  /Type /Annot
  /Subtype /Link
  /Rect [94 677 182 690]
  /Border [0 0 2]
  /C [1 0 0.5]
  /A 7 0 R
  &gt;&gt;
  endobj
  7 0 obj
  &lt;&lt;
  /Type /Action /S /Launch
  /Win &lt;&lt;/F (c:\\temp2\\pdf\\PDF Attachments\\ewsmeet.txt) &gt;&gt;
  &gt;&gt;
  endobj
  8 0 obj
  &lt;&lt; /Type /Page
  /Parent 9 0 R
  /MediaBox [0 0 600 900]
  /Contents 5 0 R
  /Annots [6 0 R ]
  /Resources &lt;&lt; /ProcSet 4 0 R
  /Font &lt;&lt; /F1 1 0 R /F2 2 0 R /F3 3 0 R &gt;&gt;
  &gt;&gt;
  &gt;&gt;
  endobj
  9 0 obj
  &lt;&lt; /Type /Pages
  /Kids [8 0 R
  ]
  /Count 1
  &gt;&gt;
  endobj
  10 0 obj
  &lt;&lt; /Type /Outlines
  /Count 0
  &gt;&gt;
  endobj
  11 0 obj
  &lt;&lt; /Type /Catalog
  /Outlines 10 0 R
  /Pages 9 0 R
  &gt;&gt;
  endobj
  xref
  0 12
  0000000000 65535 f 
  0000000015 00000 n 
  0000000122 00000 n 
  0000000232 00000 n 
  0000000341 00000 n 
  0000000369 00000 n 
  0000000603 00000 n 
  0000000713 00000 n 
  0000000819 00000 n 
  0000000997 00000 n 
  0000001055 00000 n 
  0000001102 00000 n 
  trailer
  &lt;&lt; /Size 12
  /Root 11 0 R
  &gt;&gt;
  startxref
  1169
  %%EOF
  
  </code></pre>