Пример #1
0
        public virtual void SetUserAndPageElement()
        {
            String      outPdf = destinationFolder + "setUserAndPageElement.pdf";
            String      cmpPdf = sourceFolder + "cmp_setUserAndPageElement.pdf";
            PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outPdf));
            PdfFont     font   = PdfFontFactory.CreateFont();
            PdfLayer    layer  = new PdfLayer("UserAndPageElement", pdfDoc);

            layer.SetUser("Org", "iText");
            layer.SetPageElement("HF");
            PdfCanvas canvas = new PdfCanvas(pdfDoc.AddNewPage());

            canvas.SetFontAndSize(font, 14);
            PdfLayerTestUtils.AddTextInsideLayer(layer, canvas, "Page 1 of 1.", 30, 780);
            pdfDoc.Close();
            PdfLayerTestUtils.CompareLayers(outPdf, cmpPdf);
        }