Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created October 16, 2020 10:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/d4a8760a40745dce5351a6568ed2ce88 to your computer and use it in GitHub Desktop.
Save bjoerntx/d4a8760a40745dce5351a6568ed2ce88 to your computer and use it in GitHub Desktop.
// convert PDF to byte array
byte[] baAttachment = System.IO.File.ReadAllBytes("forms.pdf");
// create a new embedded file
TXTextControl.EmbeddedFile efAttachment =
new TXTextControl.EmbeddedFile("myInvoice.pdf", baAttachment, null)
{
Description = "My embedded file."
};
// add the embedded file to TextControl
textControl1.DocumentSettings.EmbeddedFiles =
new TXTextControl.EmbeddedFile[] { efAttachment };
// save the document
textControl1.Save("mypdf.pdf", TXTextControl.StreamType.AdobePDF);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment