package at.gv.egiz.pdfas.utils; /** * PDF/A utility class * @author dferbas * */ public class PdfAUtil { /** * dferbas: Text representation of pdfa version string */ private static final String PDFA_PREFIX = "ISO 19005-1:2005 PDF/A-"; /** * Extract pdfa version from pdf metadata * @param pdfMetadata * @return */ public static String findPdfAVersion(String pdfMetadata) { String inf = pdfMetadata; String pdfaNsMark = "http://www.aiim.org/pdfa/ns/id/"; String partMark = ""; String confMark = ""; int pdfaI = inf.indexOf(pdfaNsMark); if (pdfaI > -1) { int part = inf.indexOf(partMark); StringBuffer version = new StringBuffer(PDFA_PREFIX); part = part + partMark.length(); version.append(inf.substring(part, part + 1)); int conf = inf.indexOf(confMark); conf = conf + confMark.length(); version.append(inf.substring(conf, conf + 1).toLowerCase()); return version.toString(); } else { return null; } } }