-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
32 lines (27 loc) · 1.09 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using DevExpress.Pdf;
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
namespace AttachFile {
class Program {
static void Main(string[] args) {
using (PdfDocumentProcessor processor = new PdfDocumentProcessor()) {
// Load a document.
processor.LoadDocument("..\\..\\..\\Document.pdf");
// Attach a file to the PDF document.
processor.AttachFile(new PdfFileAttachment() {
CreationDate = DateTime.Now,
Description = "This is my attach file.",
FileName = "MyAttach.txt",
Data = File.ReadAllBytes("..\\..\\..\\FileToAttach.txt"),
MimeType = "text/plain",
Relationship = PdfAssociatedFileRelationship.Supplement,
});
// The attached document.
processor.SaveDocument("..\\..\\..\\Result.pdf");
}
Process.Start(new ProcessStartInfo("..\\..\\..\\Result.pdf") { UseShellExecute = true });
}
}
}