title: iTextSharp for PDF - how add file attachments?
body: <p>I am using iTextSharp to create a PDF document in C#.  I would like to attach another file to the PDF.  I'm having just loads of trouble trying to do so.  The examples <a href="http://itextpdf.com/examples/index.php?page=toc&amp;id=7" rel="noreferrer" title="here">here</a> show some annotations, which apparently attachments are.</p>
  
  <p>This is what I've tried:</p>
  
  <pre><code>writer.AddAnnotation(its.pdf.PdfAnnotation.CreateFileAttachment(writer, new iTextSharp.text.Rectangle(100,100,100,100), "File Attachment", its.pdf.PdfFileSpecification.FileExtern(writer, "C:\\test.xml")));
  </code></pre>
  
  <p>Well, what happens is it does add an annotation on the PDF (appears as a little comment voice balloon), which i don't want.  test.xml is shown in the attachments pane in Adobe Reader, but it can't be read or saved, and its file size is unknown so it's likely that it's never being properly attached.</p>
  
  <p>Any suggestions?</p>