Exemplo n.º 1
0
        public virtual void ZoomNotOnPanel()
        {
            String      outPdf = destinationFolder + "zoomNotOnPanel.pdf";
            String      cmpPdf = sourceFolder + "cmp_zoomNotOnPanel.pdf";
            PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outPdf));
            PdfFont     font   = PdfFontFactory.CreateFont();
            PdfLayer    zoom   = new PdfLayer("Zoom 0.75-1.25", pdfDoc);

            zoom.SetOnPanel(false);
            zoom.SetZoom(0.75f, 1.25f);
            PdfCanvas canvas = new PdfCanvas(pdfDoc.AddNewPage());

            canvas.SetFontAndSize(font, 14);
            PdfLayerTestUtils.AddTextInsideLayer(zoom, canvas, "Only visible if the zoomfactor is between 75 and 125%"
                                                 , 30, 530);
            pdfDoc.Close();
            PdfLayerTestUtils.CompareLayers(outPdf, cmpPdf);
        }
Exemplo n.º 2
0
        public virtual void NotPrintNotOnPanel()
        {
            String      outPdf = destinationFolder + "notPrintNotOnPanel.pdf";
            String      cmpPdf = sourceFolder + "cmp_notPrintNotOnPanel.pdf";
            PdfDocument pdfDoc = new PdfDocument(new PdfWriter(outPdf));
            PdfFont     font   = PdfFontFactory.CreateFont();
            PdfLayer    notPrintedNotOnPanel = new PdfLayer("not printed", pdfDoc);

            notPrintedNotOnPanel.SetOnPanel(false);
            notPrintedNotOnPanel.SetPrint("Print", false);
            PdfCanvas canvas = new PdfCanvas(pdfDoc.AddNewPage());

            canvas.SetFontAndSize(font, 14);
            PdfLayerTestUtils.AddTextInsideLayer(null, canvas, "Normal page content, hello lorem ispum!", 100, 750);
            canvas.BeginLayer(notPrintedNotOnPanel);
            canvas.BeginText().SetFontAndSize(font, 24).MoveText(100, 700).ShowText("WHEN PRINTED THIS LINE IS NOT THERE"
                                                                                    ).EndText();
            canvas.BeginText().SetFontAndSize(font, 16).MoveText(100, 680).ShowText("(this text layer is not in the layers panel as well)"
                                                                                    ).EndText();
            canvas.EndLayer();
            pdfDoc.Close();
            PdfLayerTestUtils.CompareLayers(outPdf, cmpPdf);
        }