/** * Indicates whether an optional content group is enabled. * @param group the group * @return true if the group is enabled */ public boolean isGroupEnabled(PDOptionalContentGroup group) { PDOptionalContentProperties ocProperties = document.getDocumentCatalog().getOCProperties(); return ocProperties == null || ocProperties.isGroupEnabled(group); }
/** * A Catalog shall not contain the OCPProperties (Optional Content Properties) entry. * * @param ctx * @throws ValidationException */ protected void validateOCProperties(PreflightContext ctx) throws ValidationException { if (catalog.getOCProperties() != null) { addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_CATALOG_OCPROPERTIES, "A Catalog shall not contain the OCPProperties entry")); } }
/** * Imports OCProperties from source document to target document so hidden layers can still be * hidden after import. * * @param sourceDoc The source PDF document that contains the /OCProperties to be copied. * @throws IOException If an I/O error occurs. */ private void importOcProperties(PDDocument srcDoc) throws IOException { PDDocumentCatalog srcCatalog = srcDoc.getDocumentCatalog(); PDOptionalContentProperties srcOCProperties = srcCatalog.getOCProperties(); if (srcOCProperties == null) { return; } PDDocumentCatalog dstCatalog = targetDoc.getDocumentCatalog(); PDOptionalContentProperties dstOCProperties = dstCatalog.getOCProperties(); if (dstOCProperties == null) { dstCatalog.setOCProperties(new PDOptionalContentProperties( (COSDictionary) cloner.cloneForNewDocument(srcOCProperties))); } else { cloner.cloneMerge(srcOCProperties, dstOCProperties); } } }
PDOptionalContentProperties ocprops = catalog.getOCProperties(); if (ocprops == null)
private List<PDOCProperties> getOCProperties() { if (this.catalog != null) { PDOptionalContentProperties pBoxOCProperties = this.catalog.getOCProperties(); if (pBoxOCProperties != null) { List<PDOCProperties> result = new ArrayList<>(); PDOCProperties ocProperties = new PBoxPDOCProperties(pBoxOCProperties); result.add(ocProperties); return result; } } return Collections.emptyList(); }
/** * A Catalog shall not contain the OCPProperties (Optional Content Properties) entry. * * @param ctx * @throws ValidationException */ protected void validateOCProperties(PreflightContext ctx) throws ValidationException { if (catalog.getOCProperties() != null) { addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_CATALOG_OCPROPERTIES, "A Catalog shall not contain the OCPProperties entry")); } }
/** * A Catalog shall not contain the OCPProperties (Optional Content Properties) entry. * * @param ctx * @throws ValidationException */ protected void validateOCProperties(PreflightContext ctx) throws ValidationException { if (catalog.getOCProperties() != null) { addValidationError(ctx, new ValidationError(ERROR_SYNTAX_TRAILER_CATALOG_OCPROPERTIES, "A Catalog shall not contain the OCPProperties entry")); } }
/** * Imports OCProperties from source document to target document so hidden layers can still be * hidden after import. * * @param sourceDoc The source PDF document that contains the /OCProperties to be copied. * @throws IOException If an I/O error occurs. */ private void importOcProperties(PDDocument srcDoc) throws IOException { PDDocumentCatalog srcCatalog = srcDoc.getDocumentCatalog(); PDOptionalContentProperties srcOCProperties = srcCatalog.getOCProperties(); if (srcOCProperties == null) { return; } PDDocumentCatalog dstCatalog = targetDoc.getDocumentCatalog(); PDOptionalContentProperties dstOCProperties = dstCatalog.getOCProperties(); if (dstOCProperties == null) { dstCatalog.setOCProperties(new PDOptionalContentProperties( (COSDictionary) cloner.cloneForNewDocument(srcOCProperties))); } else { cloner.cloneMerge(srcOCProperties, dstOCProperties); } } }
/** * Imports OCProperties from source document to target document so hidden layers can still be * hidden after import. * * @param sourceDoc The source PDF document that contains the /OCProperties to be copied. * @throws IOException If an I/O error occurs. */ private void importOcProperties(PDDocument srcDoc) throws IOException { PDDocumentCatalog srcCatalog = srcDoc.getDocumentCatalog(); PDOptionalContentProperties srcOCProperties = srcCatalog.getOCProperties(); if (srcOCProperties == null) { return; } PDDocumentCatalog dstCatalog = targetDoc.getDocumentCatalog(); PDOptionalContentProperties dstOCProperties = dstCatalog.getOCProperties(); if (dstOCProperties == null) { dstCatalog.setOCProperties(new PDOptionalContentProperties( (COSDictionary) cloner.cloneForNewDocument(srcOCProperties))); } else { cloner.cloneMerge(srcOCProperties, dstOCProperties); } } }
PDOptionalContentProperties ocprops = catalog.getOCProperties(); if (ocprops == null) { ocprops = new PDOptionalContentProperties();
PDOptionalContentProperties ocprops = catalog.getOCProperties(); if (ocprops == null)
PDOptionalContentProperties ocprops = catalog.getOCProperties(); if (ocprops == null)