package com.pdflib.cookbook.pcos.interchange;
import com.pdflib.IpCOS;
import com.pdflib.cookbook.pcos.pcos_cookbook_example;
/**
* Retrieve PDF/X status and output intents.
*
* Required software: pCOS interface 3 (pCOS 3.x, PDFlib+PDI/PPS 7.x, TET 2.2,
* PLOP 3.x)
* Required data: PDF document
*
* @version $Id: pdfx.java,v 1.8 2015/11/16 11:53:16 stm Exp $
*/
public class pdfx extends pcos_cookbook_example {
/* This is where the data files are. Adjust as necessary. */
private final static String SEARCH_PATH = "../input";
public void example_code(IpCOS p, int doc) throws Exception {
System.out.println("File name: " + p.pcos_get_string(doc, "filename"));
String pdfx_status = p.pcos_get_string(doc, "pdfx");
if (pdfx_status.equals("none")) {
System.out.println("PDF/X version: (none)");
}
else {
System.out.println("PDF/X version: '" + pdfx_status + "'");
int output_intent_count = (int) p.pcos_get_number(doc,
"length:/Root/OutputIntents");
for (int oi = 0; oi < output_intent_count; oi += 1) {
System.out.println("Output intent " + (oi + 1));
String objtype = p.pcos_get_string(doc,
"type:/Root/OutputIntents[" + oi
+ "]/OutputConditionIdentifier");
if (objtype.equals("string")) {
System.out.println(" identifier: '"
+ p.pcos_get_string(doc, "/Root/OutputIntents[" + oi
+ "]/OutputConditionIdentifier") + "'");
}
objtype = p.pcos_get_string(doc, "type:/Root/OutputIntents["
+ oi + "]/Info");
if (objtype.equals("string")) {
System.out.println(" output info: '"
+ p.pcos_get_string(doc, "/Root/OutputIntents[" + oi
+ "]/Info") + "'");
}
}
}
}
public pdfx(String[] argv, String readable_name, String search_path,
String full_rcs_file_name, String revision) {
super(argv, readable_name, search_path, full_rcs_file_name, revision);
}
public static void main(String argv[]) {
pdfx example = new pdfx(argv, "PDF/X status", SEARCH_PATH,
"$RCSfile: pdfx.java,v $", "$Revision: 1.8 $");
example.execute();
}
}