Ejemplo n.º 1
0
        public virtual void CreatePdf(String dest)
        {
            // Initialize PDF document
            PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
            // Initialize document
            Document document = new Document(pdf);
            PdfFont  font     = PdfFontFactory.CreateFont(StandardFonts.TIMES_ROMAN);
            Style    style    = new Style();

            style.SetBackgroundColor(ColorConstants.YELLOW);
            document.Add(CreateNewTable().AddStyle(style).SetDestination("Top").SetWidth(300).SetHorizontalAlignment(HorizontalAlignment
                                                                                                                     .CENTER)).SetHorizontalAlignment(HorizontalAlignment.CENTER);
            document.Add(CreateNewTable().SetBorder(new DottedBorder(5)).SetHyphenation(new HyphenationConfig("en", "uk"
                                                                                                              , 3, 3)));
            document.Add(CreateNewTable().SetTextAlignment(TextAlignment.CENTER));
            document.Add(ListSeparatorProperties.CreateNewSeparator().SetMargin(10).SetWidth(300).SetKeepWithNext(true
                                                                                                                  ));
            document.Add(CreateNewTable().SetKeepTogether(true).SetWidth(UnitValue.CreatePercentValue(90)));
            document.Add(CreateNewTable());
            document.Add(CreateNewTable().SetRelativePosition(10, 10, 50, 10));
            document.Add(CreateNewTable());
            document.Add(new AreaBreak());
            document.Add(CreateNewTable().SetFixedPosition(100, 400, 350).SetAction(PdfAction.CreateGoTo("Top")));
            document.Add(new AreaBreak());
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.YELLOW).SetMarginBottom(10));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.LIGHT_GRAY).SetPaddingLeft(20).SetPaddingRight(50));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.YELLOW));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.LIGHT_GRAY));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.YELLOW));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.LIGHT_GRAY).SetMargin(50).SetPadding(30));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.YELLOW));
            document.Add(CreateNewTable().SetBackgroundColor(ColorConstants.LIGHT_GRAY));
            document.Close();
        }
Ejemplo n.º 2
0
        public static Div CreateNewDiv()
        {
            Div div = new Div();

            div.Add(ParagraphProperties.GetNewParagraphInstance());
            div.Add(ListSeparatorProperties.CreateNewSeparator());
            div.Add(ListProperties.CreateNewList());
            return(div);
        }