Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.BaseFont


          + "www.altisoft.com.tr / info@altisoft.com.tr";

      HeaderFooter hf = new HeaderFooter(new Phrase(headerString), false);
      document.setFooter(hf);
      document.open();
      BaseFont bf = BaseFont.createFont("C:\\WINDOWS\\Fonts\\Arial.ttf",
          BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
      Font f1 = new Font(bf, 10);
      Paragraph paragraph = new Paragraph("SATIŞ RAPORU", f1);
      paragraph.setFont(new Font(14));
      paragraph.setSpacingAfter(20);
View Full Code Here


            return fontRecord;
          }

          // filename is null, so no ttf file registered for the fontname, maybe this is
          // one of the internal fonts ...
          final BaseFont f = BaseFont.createFont(fontName, stringEncoding, embedded,
              useGlobalCache, null, null);
          if (f != null)
          {
            fontRecord = new BaseFontRecord(fontName, false, embedded, f, bold, italic);
            putToCache(fontRecord);
            return fontRecord;
          }
        }
      }

      // If we got to this point, then the font was not recognized as any known font. We will fall back
      // to Helvetica instead ..
    }
    catch (Exception e)
    {
      if (logger.isDebugEnabled())
      {
        logger.debug("BaseFont.createFont failed. Key = " + fontKey + ": " + e.getMessage(), e);
      }
      else if (logger.isWarnEnabled())
      {
        logger.warn("BaseFont.createFont failed. Key = " + fontKey + ": " + e.getMessage());
      }
    }
    // fallback .. use BaseFont.HELVETICA as default
    try
    {
      // check, whether HELVETICA is already created - yes, then return cached instance instead
      BaseFontRecord fontRecord = getFromCache(BaseFont.HELVETICA, stringEncoding, embedded);
      if (fontRecord != null)
      {
        // map all font references of the invalid font to the default font..
        // this might be not very nice, but at least the report can go on..
        putToCache(new BaseFontRecordKey(fontKey, encoding, embedded), fontRecord);
        return fontRecord;
      }

      // no helvetica created, so do this now ...
      final BaseFont f = BaseFont.createFont(BaseFont.HELVETICA, stringEncoding, embedded,
          useGlobalCache, null, null);
      if (f != null)
      {
        fontRecord = new BaseFontRecord
            (BaseFont.HELVETICA, false, embedded, f, bold, italic);
View Full Code Here

    if (fontRec != null)
    {
      return fontRec;
    }

    BaseFont f;
    try
    {
      try
      {
        f = BaseFont.createFont(filename, encoding, embedded, false, null, null);
View Full Code Here

    else
    {
      throw new IllegalArgumentException("Unknown font-identifier type encountered.");
    }

    final BaseFont baseFont = baseFontSupport.createBaseFont
        (fontName, bold, italic, context.getEncoding(), context.isEmbedded());

    return new BaseFontFontMetrics(baseFont, (float) context.getFontSize());
  }
View Full Code Here

            if (pf==null) {
              log.error("Document font " + fontName + " is not mapped to a physical font!");
              continue;
            }

            BaseFont bf = BaseFont.createFont(pf.getEmbeddedFile(),
                BaseFont.IDENTITY_H,
            BaseFont.NOT_EMBEDDED);
            baseFonts.put(fontName, bf);
           
            // bold, italic etc
View Full Code Here

           
            // step 3: we open the document
            document.open();
           
            // step 4:
            BaseFont helv = BaseFont.createFont("Helvetica", "winansi", false);
            PdfContentByte cb = writer.getDirectContent();
            cb.moveTo(0, 0);
            String text = "Some start text";
            float fontSize = 12;
            Color textColor = new GrayColor(0f);
View Full Code Here

                if (i < n) {
                    i++;
                    PdfImportedPage page2 = writer.getImportedPage(reader, i);
                    cb.addTemplate(page2, .5f, 0, 0, .5f, width / 2 + 60, 120);
                }
                BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
                cb.beginText();
                cb.setFontAndSize(bf, 14);
                cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "page " + p + " of " + ((n / 2) + (n % 2 > 0? 1 : 0)), width / 2, 40, 0);
                cb.endText();
            }
View Full Code Here

            // adding content to each page
            int i = 0;
            PdfContentByte under;
            PdfContentByte over;
            LwgImage img = LwgImage.getInstance("watermark.jpg");
            BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, BaseFont.EMBEDDED);
            img.setAbsolutePosition(200, 400);
            while (i < n) {
              i++;
              // watermark under the existing page
              under = stamp.getUnderContent(i);
View Full Code Here

        float refY = state.transformY(y);
        float angle = state.transformAngle(font.getAngle());
        float sin = (float)Math.sin(angle);
        float cos = (float)Math.cos(angle);
        float fontSize = font.getFontSize(state);
        BaseFont bf = font.getFont();
        int align = state.getTextAlign();
        float textWidth = bf.getWidthPoint(text, fontSize);
        float tx = 0;
        float ty = 0;
        float descender = bf.getFontDescriptor(BaseFont.DESCENT, fontSize);
        float ury = bf.getFontDescriptor(BaseFont.BBOXURY, fontSize);
        cb.saveState();
        cb.concatCTM(cos, sin, -sin, cos, refX, refY);
        if ((align & MetaState.TA_CENTER) == MetaState.TA_CENTER)
            tx = -textWidth / 2;
        else if ((align & MetaState.TA_RIGHT) == MetaState.TA_RIGHT)
View Full Code Here

           
            document.newPage();
           
            table = new LwgPdfPTable(4);
            float fontSize = 12;
            BaseFont bf = BaseFont.createFont("Helvetica", "winansi", false);
            table.getDefaultCell().setPaddingTop(bf.getFontDescriptor(BaseFont.ASCENT, fontSize) - fontSize + 2);
            table.getDefaultCell().setBorder(LwgRectangle.NO_BORDER);
            for (int k = 0; k < 500 * 4; ++k) {
                if (k == 0)
                    table.add(new LwgPhrase("This is an URL", new LwgFont(bf, fontSize)));
                else
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.BaseFont

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.