Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active October 22, 2020 10:13
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/1791991604fcd61a92e3b4f84aa3769d to your computer and use it in GitHub Desktop.
Save bjoerntx/1791991604fcd61a92e3b4f84aa3769d to your computer and use it in GitHub Desktop.
string sCDAData = System.IO.File.ReadAllText("004bb033-b948-4f4c-b5bf-a8dbd7d8dd40.xml");
TXTextControl.EmbeddedFile cdaAttachment =
new TXTextControl.EmbeddedFile(
"004bb033-b948-4f4c-b5bf-a8dbd7d8dd40.xml",
sCDAData,
null) {
Description = "CDA2 information",
Relationship = "Unspecified"
};
// add the attachment
textControl1.DocumentSettings.EmbeddedFiles =
new TXTextControl.EmbeddedFile[] { cdaAttachment };
X509Certificate2 cert = new X509Certificate2
("textcontrolself.pfx"),
"yourpassword");
// add the digital signature
TXTextControl.SaveSettings saveSettings = new TXTextControl.SaveSettings()
{
DigitalSignature = new TXTextControl.DigitalSignature(cert, null)
};
textControl1.Save("cover_letter.pdf", TXTextControl.StreamType.AdobePDFA, saveSettings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment