package at.gv.egiz.pdfas.utils; /** * PDF/A utility class * @author dferbas * */ public class PdfAUtil { /** * 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("PDF/A-"); 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)); return version.toString(); } else { return null; } } }