Exemplo n.º 1
0
        public virtual void HyphenSymbolTest01()
        {
            String      outFileName = destinationFolder + "hyphenSymbolTest01.pdf";
            String      cmpFileName = sourceFolder + "cmp_hyphenSymbolTest01.pdf";
            PdfDocument pdfDoc      = new PdfDocument(new PdfWriter(outFileName));
            Document    doc         = new Document(pdfDoc);
            PdfFont     font        = PdfFontFactory.CreateFont(fontsFolder + "FreeSans.ttf", PdfEncodings.IDENTITY_H, true);
            Style       style       = new Style();

            style.SetBorder(new SolidBorder(ColorConstants.BLACK, 1));
            style.SetHyphenation(new HyphenationConfig("en", "EN", 2, 2));
            style.SetFont(font);
            style.SetBackgroundColor(ColorConstants.RED);
            doc.Add(new Paragraph("tre\u2011").SetWidth(19).AddStyle(style));
            doc.Add(new Paragraph("tre\u2011\u2011").SetWidth(19).AddStyle(style));
            doc.Add(new Paragraph("r\u2011\u2011m").SetWidth(19).AddStyle(style));
            doc.Add(new Paragraph("r\u2011\u2011\u2011\u2011\u2011\u2011mmma").SetWidth(19).AddStyle(style));
            style.SetBackgroundColor(ColorConstants.BLUE);
            doc.Add(new Paragraph("tre\u2011\u2011").SetWidth(22).AddStyle(style));
            doc.Add(new Paragraph("tre\u2011\u2011m").SetWidth(22).AddStyle(style));
            doc.Add(new Paragraph("\n\n\n"));
            style.SetBackgroundColor(ColorConstants.GREEN);
            doc.Add(new Paragraph("e\u2011\u2011m\u2011ma").SetWidth(20).AddStyle(style));
            doc.Add(new Paragraph("tre\u2011\u2011m\u2011ma").SetWidth(20).AddStyle(style));
            doc.Add(new Paragraph("tre\u2011\u2011m\u2011ma").SetWidth(35).AddStyle(style));
            doc.Add(new Paragraph("tre\u2011\u2011m\u2011ma").SetWidth(40).AddStyle(style));
            style.SetBackgroundColor(ColorConstants.YELLOW);
            doc.Add(new Paragraph("ar\u2011ma").SetWidth(22).AddStyle(style));
            doc.Add(new Paragraph("ar\u2011ma").SetWidth(15).AddStyle(style));
            doc.Add(new Paragraph("ar\u2011").SetWidth(14).AddStyle(style));
            doc.Close();
            NUnit.Framework.Assert.IsNull(new CompareTool().CompareByContent(outFileName, cmpFileName, destinationFolder
                                                                             , "diff"));
        }