You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`PdfSharpCore.Pdf.PdfDocument document = new PdfSharpCore.Pdf.PdfDocument();
var p = new PdfSharpCore.Pdf.PdfPage();
document.Pages.Add(p);
var embeddedFile = new PdfSharpCore.Pdf.Advanced.PdfEmbeddedFile(document);
embeddedFile.CreateStream(Encoding.Default.GetBytes("Hello World!"));
embeddedFile.MimeType = "text/plain";
var fs = new PdfSharpCore.Pdf.Advanced.PdfFileSpecification(document, "Hello World.txt", embeddedFile);
document.Internals.AddObject(embeddedFile);
document.Internals.AddObject(fs);
var arrayName = new PdfArray(document);
var dicNames = new PdfDictionary(document);
dicNames.Elements.Add("/Names", new PdfArray(document, new PdfItem[] { new PdfString(fs.FileName), fs.Reference }));
document.Internals.AddObject(dicNames);
var dicEmbeddedFiles = new PdfDictionary(document);
dicEmbeddedFiles.Elements.Add("/EmbeddedFiles", dicNames.Reference);
document.Internals.AddObject(dicEmbeddedFiles);
Is there a way to attach a xml file to the pdf ?
Like this:
https://stackoverflow.com/questions/70597318/af-reference-to-file-embedded-into-a-pdf-with-itextsharp
The text was updated successfully, but these errors were encountered: