import java.lang.*;

import com.pdfjet.*;


/**
 *  Example_03.java
 *
 */
public class Example_03 {

    public Example_03() throws Exception {
        PDF pdf = new PDF();

        Font f1 = new Font(pdf, "Helvetica");

        Image image1 = new Image(pdf, "images/eu-map.png");
        Image image2 = new Image(pdf, "images/fruit.jpg");
        Image image3 = new Image(pdf, "images/mt-map.gif");

        Page page = new Page(pdf, A4.PORTRAIT);

        TextLine text = new TextLine(f1,
                "The map below is an embedded PNG image");
        text.setPosition(90.0, 30.0);
        text.drawOn(page);

        image1.setPosition(90, 40);
        image1.drawOn(page);

        text.setText(
                "JPG image file embedded once and drawn 3 times");
        text.setPosition(90.0, 550);
        text.drawOn(page);

        image2.setPosition(90, 560);
        image2.scaleBy(0.5);
        image2.drawOn(page);

        image2.setPosition(260, 560);
        image2.scaleBy(0.5);
        image2.drawOn(page);

        image2.setPosition(350, 560);
        image2.scaleBy(0.5);
        image2.drawOn(page);

        text.setText(
                "The map on the right is an embedded GIF image");
        text.setPosition(90.0, 800);
        text.drawOn(page);

        image3.setPosition(390, 630);
        image3.scaleBy(0.5);
        image3.drawOn(page);

        pdf.wrap();
        pdf.save("Example_03.pdf");
    }


    public static void main(String[] args) {
        try {
            new Example_03();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}   // End of Example_03.java
