Package com.jagpdf

Examples of com.jagpdf.Canvas.text()


        canvas.text_font(helv);
        /*` One of the languages representable by this encoding is Czech. We can
          pass a Unicode string ['úplnÄ›k] (full moon). [lib] converts the string
          to ISO-8859-2 and it is shown correctly. */
        String full_moon_cze = "\u00fapln\u011bk";
        canvas.text(50, 800, full_moon_cze); // ok
        /*` If we pass Swedish ['fullmåne], letter ['å] will not be shown
         because ISO-8859-2 does not represent such character. We should have
         used ISO-8859-1 encoded font instead. */
        String full_moon_swe = "fullm\u00e5ne";
        canvas.text(50, 760, full_moon_swe); // wrong
View Full Code Here


        canvas.text(50, 800, full_moon_cze); // ok
        /*` If we pass Swedish ['fullmåne], letter ['å] will not be shown
         because ISO-8859-2 does not represent such character. We should have
         used ISO-8859-1 encoded font instead. */
        String full_moon_swe = "fullm\u00e5ne";
        canvas.text(50, 760, full_moon_swe); // wrong
        /*` Let's load a Unicode encoded TrueType font. */
        //<-
        /* //->
        Font dejavu = doc.font_load("enc=utf-8; file=DejaVuSans.ttf; size=24");
        //<- */
 
View Full Code Here

        Font dejavu = doc.font_load("enc=utf-8; file=" + dejavu_file + "; size=24");
        //->
        canvas.text_font(dejavu);
        /*` Now we can mix Czech and Swedish and it will be shown correctly as
            [lib] converts the strings to UTF-8.*/
        canvas.text(50, 720, full_moon_swe);
        canvas.text(50, 680, full_moon_cze);
        //]

        doc.page_end();
        doc.finalize_doc();
View Full Code Here

        //->
        canvas.text_font(dejavu);
        /*` Now we can mix Czech and Swedish and it will be shown correctly as
            [lib] converts the strings to UTF-8.*/
        canvas.text(50, 720, full_moon_swe);
        canvas.text(50, 680, full_moon_cze);
        //]

        doc.page_end();
        doc.finalize_doc();
    }
View Full Code Here

        Canvas canvas = doc.page().canvas();
        doc.outline().item(horse);
        // adobe core font
        Font font_14 = doc.font_load("standard;name=Times-Roman;size=12;enc=windows-1250");
        canvas.text_font(font_14);
        canvas.text(50, 800, horse);
        // true type
        String res_dir = testlib.getResourcesDir();
        String fspec = "enc=utf-8; size=12; file=" + res_dir + "/fonts/DejaVuSans.ttf";
        Font font_ttf = doc.font_load(fspec);
        canvas.text_font(font_ttf);
View Full Code Here

        // true type
        String res_dir = testlib.getResourcesDir();
        String fspec = "enc=utf-8; size=12; file=" + res_dir + "/fonts/DejaVuSans.ttf";
        Font font_ttf = doc.font_load(fspec);
        canvas.text_font(font_ttf);
        canvas.text(50, 750, horse);
        // control rect
        canvas.rectangle(50, 200, 400, 450);
        canvas.path_paint("s");
        // justification
        justified_text(font_ttf, canvas, 600);
View Full Code Here

        justified_text(font_14, canvas, 550);

        // expected errors
        try {
            int[] arr_i = new int[10];
            canvas.text(0, 0, arr_i);
            assert false;
        } catch(IllegalArgumentException expected) {}

        try {
            byte[] arr_b = new byte[10];
View Full Code Here

            assert false;
        } catch(IllegalArgumentException expected) {}

        try {
            byte[] arr_b = new byte[10];
            canvas.text(0, 0, arr_b);
            assert false;
        } catch(IllegalArgumentException excpected) {}

        // finalize
        doc.page_end();
View Full Code Here

        // meat
        String res_dir = testlib.getResourcesDir();
        String image_path = res_dir + "/images-jpeg/PalmTree-CMYK-icc-FOGRA27.jpg";
        Image img = doc.image_load_file(image_path);
        canvas.image(img, 50, 50);
        canvas.text(10, 10,
                    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
                    "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +
View Full Code Here

        Image img = doc.image_load_file(image_path);
        canvas.image(img, 50, 50);
        // adobe core font
        Font font_14 = doc.font_load("standard;name=Times-Roman;size=12;enc=windows-1250");
        canvas.text_font(font_14);
        canvas.text(50, 800, horse);
        // true type
        String fspec = "enc=utf-8; size=12; file=" + res_dir + "/fonts/DejaVuSans.ttf";
        Font font_ttf = doc.font_load(fspec);
        canvas.text_font(font_ttf);
        canvas.text(50, 750, horse);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.