コード例 #1
0
ファイル: PDFSplitter.cs プロジェクト: jehan2898/root
 public PDFSplitter(PDFDocument sourcePDF)
 {
     this.pdfDocument = sourcePDF;
 }
コード例 #2
0
 public PDFPageContentStream(PDFDocument pdfDocument, PDFPage sourcePage, bool appendContent, bool compress, bool resetContext)
 {
     PDPageContentStream.AppendMode aPPEND = PDPageContentStream.AppendMode.APPEND;
     aPPEND = (!appendContent ? PDPageContentStream.AppendMode.OVERWRITE : PDPageContentStream.AppendMode.APPEND);
     this.pageContentStream = new PDPageContentStream(pdfDocument.PDFBoxDocument, sourcePage.PDFBoxPage, aPPEND, compress);
 }
コード例 #3
0
ファイル: PDFImageExtractor.cs プロジェクト: jehan2898/root
 public PDFImageExtractor(PDFDocument doc)
 {
     this.pdfDocument = doc.PDFBoxDocument;
 }
コード例 #4
0
 public PDFPageContentStream(PDFDocument pdfDocument, PDFPage sourcePage, bool appendContent, bool compress)
 {
     this.pageContentStream = new PDPageContentStream(pdfDocument.PDFBoxDocument, sourcePage.PDFBoxPage, PDPageContentStream.AppendMode.APPEND, compress);
 }
コード例 #5
0
 public PDFPageContentStream(PDFDocument pdfDocument, PDFPage sourcePage)
 {
     this.pageContentStream = new PDPageContentStream(pdfDocument.PDFBoxDocument, sourcePage.PDFBoxPage);
 }
コード例 #6
0
ファイル: PDFOverlay.cs プロジェクト: jehan2898/root
 public PDFOverlay(PDFDocument overlay, PDFDocument overlayDestination)
 {
     this.overlay            = overlay;
     this.overlayDestination = overlayDestination;
 }
コード例 #7
0
ファイル: PDF2Image.cs プロジェクト: jehan2898/root
 public PDF2Image(PDFDocument doc)
 {
     this.pdfDocument = doc.PDFBoxDocument;
 }
コード例 #8
0
        public bool AddAnnotation(PDFAnnotation annotation, PDFDocument doc)
        {
            bool result;

            try
            {
                List        annotations = this.PDFBoxPage.getAnnotations();
                PDRectangle rectangle   = new PDRectangle(annotation.Position.X, this.MediaBox.Height - annotation.Position.Y - annotation.Position.Height, annotation.Position.Width, annotation.Position.Height);
                annotation.pdfAnotation.setRectangle(rectangle);
                bool flag = annotation.type == PDFAnnotationType.PDFAnnotationLine;
                if (flag)
                {
                    PDAnnotationLine pDAnnotationLine = (PDAnnotationLine)annotation.pdfAnotation;
                    float[]          array            = new float[4];
                    switch (annotation.Direction)
                    {
                    case PDFDirection.DIAGONALLEFTUP:
                        array[2] = annotation.Position.PDFBoxRectangle.getLowerLeftX();
                        array[3] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY();
                        array[0] = annotation.Position.PDFBoxRectangle.getLowerLeftX() + annotation.Position.PDFBoxRectangle.getWidth();
                        array[1] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY() - annotation.Position.PDFBoxRectangle.getHeight();
                        break;

                    case PDFDirection.DIAGONALRIGHTUP:
                        array[0] = annotation.Position.PDFBoxRectangle.getLowerLeftX();
                        array[1] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY() - annotation.Position.PDFBoxRectangle.getHeight();
                        array[2] = annotation.Position.PDFBoxRectangle.getLowerLeftX() + annotation.Position.PDFBoxRectangle.getWidth();
                        array[3] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY();
                        break;

                    case PDFDirection.DIAGONALRIGHTDOWN:
                        array[0] = annotation.Position.PDFBoxRectangle.getLowerLeftX();
                        array[1] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY();
                        array[2] = annotation.Position.PDFBoxRectangle.getLowerLeftX() + annotation.Position.PDFBoxRectangle.getWidth();
                        array[3] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY() - annotation.Position.PDFBoxRectangle.getHeight();
                        break;

                    case PDFDirection.DIAGONALLEFTDOWN:
                        array[2] = annotation.Position.PDFBoxRectangle.getLowerLeftX();
                        array[3] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY() - annotation.Position.PDFBoxRectangle.getHeight();
                        array[0] = annotation.Position.PDFBoxRectangle.getLowerLeftX() + annotation.Position.PDFBoxRectangle.getWidth();
                        array[1] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY();
                        break;
                    }
                    pDAnnotationLine.setLine(array);
                    annotations.add(pDAnnotationLine);
                }
                else
                {
                    bool flag2 = annotation.type == PDFAnnotationType.PDFAnnotationTextMarkup;
                    if (flag2)
                    {
                        PDAnnotationTextMarkup pDAnnotationTextMarkup = (PDAnnotationTextMarkup)annotation.pdfAnotation;
                        float[] array2 = new float[8];
                        array2[0] = annotation.Position.PDFBoxRectangle.getLowerLeftX();
                        array2[1] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getUpperRightY() - 2f;
                        array2[2] = annotation.Position.PDFBoxRectangle.getUpperRightX();
                        array2[3] = array2[1];
                        array2[4] = array2[0];
                        array2[5] = this.PDFBoxPage.getCropBox().getHeight() - annotation.Position.PDFBoxRectangle.getLowerLeftY() - 2f;
                        array2[6] = array2[2];
                        array2[7] = array2[5];
                        pDAnnotationTextMarkup.setQuadPoints(array2);
                        annotations.add(pDAnnotationTextMarkup);
                    }
                    else
                    {
                        bool flag3 = annotation.type == PDFAnnotationType.PDFAnnotationLink;
                        if (flag3)
                        {
                            PDAnnotationLink pDAnnotationLink = (PDAnnotationLink)annotation.pdfAnotation;
                            bool             flag4            = !string.IsNullOrEmpty(annotation.LinkURL);
                            if (flag4)
                            {
                                PDActionURI pDActionURI = new PDActionURI();
                                pDActionURI.setURI(annotation.LinkURL);
                                pDAnnotationLink.setAction(pDActionURI);
                            }
                            else
                            {
                                Console.WriteLine("The PDFAnnotationLink has no LinkURL property. Set this property for the link to work well.");
                            }
                            annotations.add(pDAnnotationLink);
                        }
                        else
                        {
                            bool flag5 = annotation.type == PDFAnnotationType.PDFAnnotationRubberStamp;
                            if (flag5)
                            {
                                PDAnnotationRubberStamp pDAnnotationRubberStamp = (PDAnnotationRubberStamp)annotation.pdfAnotation;
                                pDAnnotationRubberStamp.setName("TopSecret");
                                pDAnnotationRubberStamp.setAppearance(PDFHelper.GetRubberStampAppearance(doc, annotation.Position, annotation.SubType));
                                pDAnnotationRubberStamp.setRectangle(rectangle);
                                annotations.add(pDAnnotationRubberStamp);
                            }
                            else
                            {
                                annotations.add(annotation.pdfAnotation);
                            }
                        }
                    }
                }
                result = true;
            }
            catch (Exception ex)
            {
                throw new PDFToolkitException(ex.Message, ex);
            }
            return(result);
        }