-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.vb
20 lines (17 loc) · 947 Bytes
/
Program.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Imports System.IO
Imports DevExpress.Pdf
Namespace AttachFile
Friend Class Program
Shared Sub Main(ByVal args As String())
Using processor As PdfDocumentProcessor = New PdfDocumentProcessor()
' Load a document.
processor.LoadDocument("..\..\..\Document.pdf")
' Attach a file to the PDF document.
processor.AttachFile(New PdfFileAttachment() With {.CreationDate = Date.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")
End Using
Process.Start(New ProcessStartInfo("..\..\..\Result.pdf") With {.UseShellExecute = True})
End Sub
End Class
End Namespace