Exemple #1
0
        public virtual void CreatePDF(String dest)
        {
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(dest));

            // সুরে মিললে সুর হবে
            String line1 =
                "\u09B8\u09C1\u09B0\u09C7\u0020\u09AE\u09BF\u09B2\u09B2\u09C7\u0020\u09B8\u09C1\u09B0\u0020\u09B9"
                + "\u09AC\u09C7";

            Rectangle rectangleAnnot = new Rectangle(55, 650, 35, 35);

            // Create a stamp annotation and set some properties
            PdfAnnotation annotation = new PdfStampAnnotation(rectangleAnnot);

            annotation
            .SetContents(line1)
            .SetColor(ColorConstants.CYAN);

            // Add an empty page to the document, then add the annotation to the page
            PdfPage page = pdfDocument.AddNewPage();

            page.AddAnnotation(annotation);

            pdfDocument.Close();
        }
 public virtual void AnnotationCheckTest13()
 {
     NUnit.Framework.Assert.That(() => {
         PdfWriter writer = new PdfWriter(new ByteArrayOutputStream());
         Stream @is       = new FileStream(sourceFolder + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read);
         PdfADocument doc = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_2A, new PdfOutputIntent("Custom", ""
                                                                                                        , "http://www.color.org", "sRGB IEC61966-2.1", @is));
         doc.SetTagged();
         doc.GetCatalog().SetLang(new PdfString("en-US"));
         PdfPage page        = doc.AddNewPage();
         Rectangle rect      = new Rectangle(100, 650, 400, 100);
         PdfAnnotation annot = new PdfStampAnnotation(rect);
         annot.SetFlags(PdfAnnotation.PRINT);
         annot.SetContents("Hello world");
         page.AddAnnotation(annot);
         doc.Close();
     }
                                 , NUnit.Framework.Throws.InstanceOf <PdfAConformanceException>().With.Message.EqualTo(PdfAConformanceException.EVERY_ANNOTATION_SHALL_HAVE_AT_LEAST_ONE_APPEARANCE_DICTIONARY))
     ;
 }
        public virtual void AnnotationCheckTest09()
        {
            String       outPdf = destinationFolder + "pdfA1a_annotationCheckTest09.pdf";
            String       cmpPdf = cmpFolder + "cmp_pdfA1a_annotationCheckTest09.pdf";
            PdfWriter    writer = new PdfWriter(outPdf);
            Stream       @is    = new FileStream(sourceFolder + "sRGB Color Space Profile.icm", FileMode.Open, FileAccess.Read);
            PdfADocument doc    = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_1A, new PdfOutputIntent("Custom", ""
                                                                                                              , "http://www.color.org", "sRGB IEC61966-2.1", @is));

            doc.SetTagged();
            doc.GetCatalog().SetLang(new PdfString("en-US"));
            PdfPage       page  = doc.AddNewPage();
            Rectangle     rect  = new Rectangle(100, 100, 100, 100);
            PdfAnnotation annot = new PdfStampAnnotation(rect);

            annot.SetFlag(PdfAnnotation.PRINT);
            annot.SetContents("Hello world");
            page.AddAnnotation(annot);
            doc.Close();
            CompareResult(outPdf, cmpPdf);
        }
        public virtual void CreatePDF(String dest)
        {
            PdfDocument pdfDocument = new PdfDocument(new PdfWriter(dest));

            // في القيام بنشاط
            String line1 = "\u0641\u064A\u0020\u0627\u0644\u0642\u064A\u0627\u0645\u0020\u0628\u0646\u0634\u0627\u0637";

            // Create a rectangle for an annotation
            Rectangle rectangleAnnot = new Rectangle(55, 650, 35, 35);

            // Create a stamp annotation and set some properties
            PdfAnnotation annotation = new PdfStampAnnotation(rectangleAnnot);

            annotation
            .SetContents(line1)
            .SetColor(ColorConstants.CYAN);

            // Add an empty page to the document, then add the annotation to the page
            PdfPage page = pdfDocument.AddNewPage();

            page.AddAnnotation(annotation);

            pdfDocument.Close();
        }