Example_33

Using the SVGImage component.

Example_33.pdf — the PDF this example creates.

/*
 * Example_33.java
 *
 * Copyright (c) 2026 PDFjet Software
 * Licensed under the MIT License. See LICENSE file in the project root.
 */
package examples;

import java.io.*;
import com.pdfjet.*;

/**
 * Example_33.java
 */
public class Example_33 {
    public Example_33() throws Exception {
        PDF pdf = new PDF(
            new BufferedOutputStream(new FileOutputStream("Example_33.pdf")));

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

        SVGImage image = new SVGImage("images/svg-test/europe.svg");
        image.setLocation(-150f, 0f);
        float[] xy = image.drawOn(page);

        image = new SVGImage(
            "images/svg/shopping_cart_checkout_FILL0_wght400_GRAD0_opsz48.svg");
        image.setLocation(20f, 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg/add_circle_FILL0_wght400_GRAD0_opsz48.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg/palette_FILL0_wght400_GRAD0_opsz48.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg/auto_stories_FILL0_wght400_GRAD0_opsz48.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg/star_FILL0_wght400_GRAD0_opsz48.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg-test/test-CS.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg-test/test-QQ1.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg-test/menu-icon.svg");
        image.setLocation(xy[0], 670f);
        xy = image.drawOn(page);

        image = new SVGImage("images/svg-test/menu-icon-close.svg");
        image.setLocation(xy[0], 670f);
        image.drawOn(page);

        pdf.complete();
    }

    public static void main(String[] args) throws Exception {
        long time0 = System.currentTimeMillis();
        new Example_33();
        long time1 = System.currentTimeMillis();
        System.out.printf("Example_33 => %4d ms%n", time1 - time0);
    }
}   // End of Example_33.java

©2026 PDFjet Software.