Пример #1
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Attachments();
            //open document
            PdfContentEditor contentEditor = new PdfContentEditor();

            contentEditor.BindPdf(dataDir + "DeleteAllAttachments.pdf");

            //delete attachments
            contentEditor.DeleteAttachments();

            //save updated PDF
            contentEditor.Save(dataDir + "DeleteAllAttachments_out.pdf");
        }
Пример #2
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Attachments();
            //open document
            PdfExtractor pdfExtractor = new PdfExtractor();

            pdfExtractor.BindPdf(dataDir + "ExtractAllAttachments.pdf");

            //extract attachments
            pdfExtractor.ExtractAttachment();

            //get extracted attachments
            pdfExtractor.GetAttachment(dataDir + ".\\output");
        }
Пример #3
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Attachments();
            //open document
            PdfContentEditor contentEditor = new PdfContentEditor();

            contentEditor.BindPdf(dataDir + "AddAttachment.pdf");

            //add attachment
            contentEditor.AddDocumentAttachment(dataDir + "test.txt", "Attachment Description");

            //save updated PDF
            contentEditor.Save(dataDir + "AddAttachment_out.pdf");
        }
Пример #4
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Attachments();
            //open document
            PdfContentEditor contentEditor = new PdfContentEditor();

            contentEditor.BindPdf(dataDir + "AddAttachment-Stream.pdf");

            //read file into stream (FileStream or MemoryStream)
            FileStream fileStream = new FileStream(dataDir + "test.txt", FileMode.Open);

            //add attachment
            contentEditor.AddDocumentAttachment(fileStream, "Attachment Name", "Attachment Description");

            //save updated PDF
            contentEditor.Save(dataDir + "AddAttachment-Stream_out.pdf");
        }
Пример #5
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_AsposePdfFacades_Attachments();
            //open document
            PdfExtractor pdfExtractor = new PdfExtractor();

            pdfExtractor.BindPdf(dataDir + "GetAttachmentNames.pdf");

            //extract attachments
            pdfExtractor.ExtractAttachment();

            //get attachment names
            System.Collections.IList attachmentNames = (System.Collections.IList)pdfExtractor.GetAttachNames();

            foreach (string attachmentName in attachmentNames)
            {
                Console.WriteLine("Name : {0}", attachmentName);
            }
        }