}
private int parsePDFProfile(String[] args, int i) throws FOPException {
if ((i + 1 == args.length)
|| (args[i + 1].charAt(0) == '-')) {
throw new FOPException("You must specify a PDF profile");
} else {
String profile = args[i + 1];
PDFAMode pdfAMode = PDFAMode.valueOf(profile);
if (pdfAMode != null && pdfAMode != PDFAMode.DISABLED) {
if (renderingOptions.get("pdf-a-mode") != null) {
throw new FOPException("PDF/A mode already set");
}
renderingOptions.put("pdf-a-mode", pdfAMode.getName());
return 1;
} else {
PDFXMode pdfXMode = PDFXMode.valueOf(profile);
if (pdfXMode != null && pdfXMode != PDFXMode.DISABLED) {
if (renderingOptions.get("pdf-x-mode") != null) {
throw new FOPException("PDF/X mode already set");
}
renderingOptions.put("pdf-x-mode", pdfXMode.getName());
return 1;
}
}
throw new FOPException("Unsupported PDF profile: " + profile);
}
}