Package com.lowagie.text.pdf

Examples of com.lowagie.text.pdf.DefaultFontMapper


   * @return text box
   */
  public Rectangle getTextSize(String text, Font font) {
    template.saveState();
    // get the font
    DefaultFontMapper mapper = new DefaultFontMapper();
    BaseFont bf = mapper.awtToPdf(font);
    template.setFontAndSize(bf, font.getSize());
    // calculate text width and height
    float textWidth = template.getEffectiveStringWidth(text, false);
    float ascent = bf.getAscentPoint(text, font.getSize());
    float descent = bf.getDescentPoint(text, font.getSize());
View Full Code Here


   * @param fontColor colour
   */
  public void drawText(String text, Font font, Rectangle box, Color fontColor) {
    template.saveState();
    // get the font
    DefaultFontMapper mapper = new DefaultFontMapper();
    BaseFont bf = mapper.awtToPdf(font);
    template.setFontAndSize(bf, font.getSize());

    // calculate descent
    float descent = 0;
    if (text != null) {
View Full Code Here

        public PDFExporter(Document pdf) {
            this.pdf = pdf;
        }

        public void docStart(PdfWriter out, SketchDocument doc) {
            mapper = new DefaultFontMapper();
            try {
                File tempdir = File.createTempFile("leonardosketch_pdfexport", "_tempdir");
                tempdir = new File(tempdir.getAbsolutePath()+"2");
                boolean ret = tempdir.mkdirs();
                List<Asset> fonts = Main.getDatabase().getAllFonts();
View Full Code Here

         // step 4
         PdfContentByte cb = writer.getDirectContent();

         PdfTemplate tp = cb.createTemplate(width, height);

         Graphics2D g2d = tp.createGraphics(width, height, new DefaultFontMapper());


         Rectangle2D r2d = new Rectangle2D.Double(0, 0, width, height);

         chart.draw(g2d, r2d);
View Full Code Here

         // step 4
         PdfContentByte cb = writer.getDirectContent();

         PdfTemplate tp = cb.createTemplate(width, height);

         Graphics2D g2d = tp.createGraphics(width, height, new DefaultFontMapper());

         Rectangle2D r2d = new Rectangle2D.Double(0, 0, width, height);

         chart.draw(g2d, r2d);
         g2d.dispose();
View Full Code Here

            // step 4: we grab the ContentByte and do some stuff with it

            // we create a fontMapper and read all the fonts in the font
            // directory
            DefaultFontMapper mapper = new DefaultFontMapper();
            FontFactory.registerDirectories();

            // we create a template and a Graphics2D object that corresponds
            // with it
            PdfContentByte cb = writer.getDirectContent();
View Full Code Here

    @Override
    public synchronized void runDuringSimulation(DomPhysEnv env, Wink simZyk,
            ParCollection params) {
        super.runDuringSimulation(env, simZyk, params);
        try {
            StaticMethods.saveEnvironmentViewAsPDF(new File("test.pdf"), env, new DefaultFontMapper());
            System.exit(0);
        } catch (Exception e) {
        }
    }
View Full Code Here

                "",
                "",
                new String[] {"MA right-to-left", "Fitness sum"},
                new Double[][] {fitVerlaufMA2, fitVerlauf});
        try {
            StaticMethods.saveChartAsPDF(new File(params.getStdDirectory() + File.separator + fileNamePrefix + ".pdf"), chart, 600, 400, new DefaultFontMapper());
        } catch (IOException e) {
            throw new RuntimeException("PDF not generated.");
        }
       
        return bestPopNum;
View Full Code Here

                    fileName));
            document.open();
            PdfContentByte contentByte = writer.getDirectContent();
            PdfTemplate template = contentByte.createTemplate(width, height);
            Graphics2D graphics2d = template.createGraphics(width, height,
                    new DefaultFontMapper());
            Rectangle2D rectangle2d = new Rectangle2D.Double(0, 0, width,
                    height);
    
            chart.draw(graphics2d, rectangle2d);
    
View Full Code Here

  }
   
    private void handleChartEventStoreAsPDF(ChartEventStoreAsPDF event) {
        File file = event.getFile();
        try {
            StaticMethods.saveChartAsPDF(file, chartList.get(event.getChartNam()), 400, 300, new DefaultFontMapper());
        } catch (IOException e) {
            throw new RuntimeException(this.id().toUpperCase() + " - PDF not stored '" + event.getFile() + "'");
        }
    }
View Full Code Here

TOP

Related Classes of com.lowagie.text.pdf.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.