import java.io.PrintStream; import java.io.UnsupportedEncodingException; import com.pdflib.TETException; import com.pdflib.TET; /** * PDF image extractor based on PDFlib TET. *
* Required software: TET 3 *
* Required data: PDF document
*
* @version $Id: image_extractor.java,v 1.6 2008/12/15 10:50:54 stm Exp $
*/
public class image_extractor
{
/**
* Global option list
*/
static final String GLOBAL_OPTLIST = "searchpath={../resource/cmap "
+ "../resource/glyphlist ../input}";
/**
* Document-specific option list
*/
static final String DOC_OPTLIST = "";
/**
* Page-specific option list
*/
static final String PAGE_OPTLIST = "granularity=page";
/**
* Basic image extract options (more below)
*/
static final String BASE_IMAGE_OPTLIST = "compression=auto format=auto";
/**
* The encoding in which the output is sent to System.out. For running the
* example in a Windows command window, you can set this for example to
* "windows-1252" for getting Latin-1 output.
*/
private static final String OUTPUT_ENCODING = System
.getProperty("file.encoding");
/**
* For printing to System.out in the encoding specified via OUTPUT_ENCODING.
*/
private static PrintStream out;
public static void main(String argv[]) throws UnsupportedEncodingException {
System.out.println("Using output encoding \"" + OUTPUT_ENCODING + "\"");
out = new PrintStream(System.out, true, OUTPUT_ENCODING);
TET tet = null;
try {
if (argv.length != 1) {
throw new Exception("usage: image_extractor