package com.pdflib.cookbook.pcos.interchange; import com.pdflib.IpCOS; import com.pdflib.cookbook.pcos.pcos_cookbook_example; /** * Retrieve PDF/A 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: pdfa.java,v 1.8 2015/11/16 11:53:16 stm Exp $ */ public class pdfa 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 pdfa_status = p.pcos_get_string(doc, "pdfa"); if (pdfa_status.equals("none")) { System.out.println("PDF/A version: (none)"); } else { System.out.println("PDF/A version: '" + pdfa_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 pdfa(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[]) { pdfa example = new pdfa(argv, "PDF/A status", SEARCH_PATH, "$RCSfile: pdfa.java,v $", "$Revision: 1.8 $"); example.execute(); } }