Package com.itextpdf.awt

Examples of com.itextpdf.awt.DefaultFontMapper


      document.open();
      PdfContentByte cb = writer.getDirectContent();
      PdfTemplate tp = cb.createTemplate(graphContainer.getWidth(),
          graphContainer.getHeight());
      Graphics2D g2d = tp.createGraphics(graphContainer.getWidth(),
          graphContainer.getHeight(), new DefaultFontMapper());

      graphContainer.addNotify();
      graphContainer.validate();

      graphContainer.paint(g2d);
View Full Code Here


            } else if (filter.type == FORMAT_PDF) {
              com.itextpdf.text.Document document = new com.itextpdf.text.Document(new Rectangle(width, height));
              PdfWriter writer = PdfWriter.getInstance(document, stream);
              document.open();
              PdfContentByte cb = writer.getDirectContent();
              DefaultFontMapper fontMapper = new DefaultFontMapper();
              BaseFontParameters fontParameters = new BaseFontParameters("LiberationSans-Regular.ttf");
              fontParameters.encoding = BaseFont.IDENTITY_H;
              fontMapper.putName("Dialog.plain", fontParameters);
              fontMapper.putName("SansSerif.plain", fontParameters);
              PdfGraphics2D pdfGraphics = new PdfGraphics2D(cb, width, height, fontMapper);
              paint(pdfGraphics, bds, circuit, width, height);
              pdfGraphics.dispose();
              document.close();
            } else {
View Full Code Here

     * <p/>
     * This method can be called multiple times.
     */
    public static void initialize() {
        if (initialized) return;
        fontMapper = new DefaultFontMapper();
        String osName = System.getProperty("os.name");
        if (osName.startsWith("Windows")) {
            // TODO: Windows is not installed under C:\Windows all the time.
            fontMapper.insertDirectory("C:\\windows\\fonts");
        } else if (osName.startsWith("Mac OS X")) {
View Full Code Here

TOP

Related Classes of com.itextpdf.awt.DefaultFontMapper

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.