EncapsulatedPostScript.java Source code

Java tutorial

Introduction

Here is the source code for EncapsulatedPostScript.java

Source

import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfWriter;

public class EncapsulatedPostScript {
    public static void main(String[] args) {
        Document document = new Document(PageSize.A4, 50, 50, 50, 50);
        try {
            PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("EncapsulatedPostScript.pdf"));
            document.open();
            Image img = Image.getInstance("yourpsFile.ps");
            img.scalePercent(50);
            document.add(img);
            document.close();
        } catch (Exception de) {
            de.printStackTrace();
        }
    }
}