Created
July 7, 2023 08:12
-
-
Save bjoerntx/617c186328386f0e97b87e352144579a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Text; | |
using (TXTextControl.ServerTextControl tx = new TXTextControl.ServerTextControl()) { | |
tx.Create(); | |
tx.Text = "This is a sample PDF document with an attachment"; | |
byte[] baAttachment = Encoding.ASCII.GetBytes("This is a textual attachment."); | |
// create a new embedded file | |
TXTextControl.EmbeddedFile efAttachment = | |
new TXTextControl.EmbeddedFile("attachment.tx", baAttachment, null) { | |
Description = "My embedded text file." | |
}; | |
// add the embedded file to TextControl | |
tx.DocumentSettings.EmbeddedFiles = | |
new TXTextControl.EmbeddedFile[] { efAttachment }; | |
// save the document | |
tx.Save("mypdf.pdf", TXTextControl.StreamType.AdobePDF); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment