コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Create a pdf document
            PdfDocument doc = new PdfDocument();

            //Load the document from disk
            doc.LoadFromFile(@"..\..\..\..\..\..\Data\DeleteImage.pdf");

            //Get the first page
            PdfPageBase page = doc.Pages[0];

            //Delete the first image on the page
            page.DeleteImage(0);

            //Save the document
            doc.SaveToFile("Output.pdf");

            //Launch the Pdf file
            PDFDocumentViewer("Output.pdf");
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            //Pdf file
            String file = @"..\..\..\..\..\..\Data\DeleteImage.pdf";

            //Open pdf document
            PdfDocument pdf = new PdfDocument();

            pdf.LoadFromFile(file);

            //Get the first page
            PdfPageBase page = pdf.Pages[0];

            //Delete the first image on the page
            page.DeleteImage(page.ImagesInfo[0].Image);

            String result = "DeleteImage_out.pdf";

            //Save the document
            pdf.SaveToFile(result);
            //Launch the Pdf file
            PDFDocumentViewer(result);
        }