Package org.faceless.pdf2
Enum OutputProfiler.Strategy
- java.lang.Object
-
- java.lang.Enum<OutputProfiler.Strategy>
-
- org.faceless.pdf2.OutputProfiler.Strategy
-
- All Implemented Interfaces:
Serializable
,Comparable<OutputProfiler.Strategy>
- Enclosing class:
- OutputProfiler
public static enum OutputProfiler.Strategy extends Enum<OutputProfiler.Strategy>
The Strategy enum determines how a PDF is repaired when an OutputProfile is applied to it - for example, are invalid fields in the metadata deleted? Or should the conversion fail?.
The default strategy is one which does not delete any data, but other strategies may be chosen by calling
OutputProfiler.setStrategy(org.faceless.pdf2.OutputProfiler.Strategy...)
- Since:
- 2.26
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AdjustXMPNamespaces
Strategy that will adjust any namespaces in the XMP so they meet the rules required by XMP.AutoConformance
Where a PDF cannot meet a particular level of conformance, such as PDF/A-1a or PDF/A-2a, give the OutputProfiler to downgrade the level of conformance to PDF/A-1b, PDF/A-2b etc.ConvertAttachments
PDF/A-2 and later permit attachments but only if the attachments are themselves valid PDF/A-2 documents.Default
The default strategy will not delete any content to make the OutputProfile matchFlattenDisallowedAnnotations
If disallowed annotation types are found, flatten them onto the page rather than removing them.FlattenSignatures
Strategy that will remove signed signatures by flattening them onto the page, if that's what's required to match the target OutputProfile.JustFixIt
Strategy that will do whatever it takes to make the PDF match the target OutputProfile, removing whatever it takes to get there.OverprintICCtoDevice
When overprinting is disallowed in CMYK ICC profiles, as it is for PDF/A-2 and later, we have two choices.PartialPage
Whether it's preferable to return a partially rendered page (if unrecoverable damage was found while rasterizing it), as opposed to failing.Rebuild
Where a PDF cannot be repaired, this option will copy the content to a new PDF, reset the current PDF and move the content back.RecolorAnnotations
Strategy that will convert CMYK to RGB (or vice versa) in annotations if that's what's required to match the target OutputProfile.RemoveColorProfile
Strategy that will remove ICC Profiles if that's what's required to match the target OutputProfile.RemoveEmbeddedFiles
Strategy that will remove any Embedded Files that cannot be made compliant.RemoveForm
Strategy that will remove any form content that cannot be made to match the target OutputProfile, including the XFA form, signed signatures that are invalid for any reasonRemoveHiddenAnnotations
If hidden annotations are not allowed in the target OutputProfile, by default they will be made visible.RemoveInvalidXMPFields
Strategy that will remove invalid or undefined fields from the XMPRemoveInvalidXMPProperties
Strategy that will remove invalid or undefined properties from the XMPRemoveReaderExtensions
Strategy that will remove reader-extensions, if that's what's required to match the target OutputProfile.RemoveRelaxNGSchema
Strategy that will remove the RelaxNG schema from the XMP if required to meet the target OutputProfile.RemoveSignatures
Strategy that will remove signed signatures, if that's what's required to match the target OutputProfile.RepairToUnicodeCodeLength
The ToUnicode map, used to give meaning to glyphs in the PDF, is sometimes created in a particular way (with two-byte codes where single-bye are requried) that means it must be ignored by Acrobat.SeparationMergeAcrobat
PDF/A-2 and later require that the same color definition is used for each Separation plate in the PDF.SeparationMergeRename
PDF/A-2 and later require that the same color definition is used for each Separation plate in the PDF.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getValue()
Return the numeric value for this strategy.static OutputProfiler.Strategy
valueOf(String name)
Returns the enum constant of this type with the specified name.static OutputProfiler.Strategy[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
Default
public static final OutputProfiler.Strategy Default
The default strategy will not delete any content to make the OutputProfile match
-
RemoveInvalidXMPProperties
public static final OutputProfiler.Strategy RemoveInvalidXMPProperties
Strategy that will remove invalid or undefined properties from the XMP
-
RemoveInvalidXMPFields
public static final OutputProfiler.Strategy RemoveInvalidXMPFields
Strategy that will remove invalid or undefined fields from the XMP
-
AdjustXMPNamespaces
public static final OutputProfiler.Strategy AdjustXMPNamespaces
Strategy that will adjust any namespaces in the XMP so they meet the rules required by XMP. In practice, this means that any namespace UR that does not end in a "#" or "/" will have a "#" appended to it.
-
RemoveRelaxNGSchema
public static final OutputProfiler.Strategy RemoveRelaxNGSchema
Strategy that will remove the RelaxNG schema from the XMP if required to meet the target OutputProfile.
-
RemoveForm
public static final OutputProfiler.Strategy RemoveForm
Strategy that will remove any form content that cannot be made to match the target OutputProfile, including the XFA form, signed signatures that are invalid for any reason
-
FlattenSignatures
public static final OutputProfiler.Strategy FlattenSignatures
Strategy that will remove signed signatures by flattening them onto the page, if that's what's required to match the target OutputProfile. If this feature is not set butRemoveSignatures
is set, the signatures will be removed without flattening them.- Since:
- 2.28
-
RemoveSignatures
public static final OutputProfiler.Strategy RemoveSignatures
Strategy that will remove signed signatures, if that's what's required to match the target OutputProfile. UnlikeFlattenSignatures
the signatures will simply be removed, leaving no mark on the page. If both this andFlattenSignatures
are set,FlattenSignatures
takes precedence..
-
RemoveColorProfile
public static final OutputProfiler.Strategy RemoveColorProfile
Strategy that will remove ICC Profiles if that's what's required to match the target OutputProfile.
-
RecolorAnnotations
public static final OutputProfiler.Strategy RecolorAnnotations
Strategy that will convert CMYK to RGB (or vice versa) in annotations if that's what's required to match the target OutputProfile. Setting this strategy will set an appropriate ColorAction on the OutputProfiler if none exists.
-
Rebuild
public static final OutputProfiler.Strategy Rebuild
Where a PDF cannot be repaired, this option will copy the content to a new PDF, reset the current PDF and move the content back. It's guaranteed to result in a valid file
-
AutoConformance
public static final OutputProfiler.Strategy AutoConformance
Where a PDF cannot meet a particular level of conformance, such as PDF/A-1a or PDF/A-2a, give the OutputProfiler to downgrade the level of conformance to PDF/A-1b, PDF/A-2b etc. This is very useful if the "Rebuild" option is set - if the supplied PDF is PDF/A-1a but the damage to the PDF is such that the StructureTree has to be removed, downgrading to PDF/A-1b is an alternative to failing. Even if the PDF is not being rebuilt, if it's found that a PDF cannot meet PDF/A-2u but can met PDF/A-2b, it will be applied
-
RemoveEmbeddedFiles
public static final OutputProfiler.Strategy RemoveEmbeddedFiles
Strategy that will remove any Embedded Files that cannot be made compliant.
-
RemoveHiddenAnnotations
public static final OutputProfiler.Strategy RemoveHiddenAnnotations
If hidden annotations are not allowed in the target OutputProfile, by default they will be made visible. This will often alter the appearance of the PDF, so an alternative if this Strategy is set is to remove them.
-
FlattenDisallowedAnnotations
public static final OutputProfiler.Strategy FlattenDisallowedAnnotations
If disallowed annotation types are found, flatten them onto the page rather than removing them.
-
SeparationMergeAcrobat
public static final OutputProfiler.Strategy SeparationMergeAcrobat
PDF/A-2 and later require that the same color definition is used for each Separation plate in the PDF. This leads to problems when one color is defined twice using two wildly different colors, which happens more than you'd think. Acrobat has an ad-hoc process for choosing which one to use, which we believe we've largely derived, and this algorithm will attempt to replicate as closely as possible. Where it's unable to, the page will be rasterized. This is the default stratagy used byJustFixIt
.
-
SeparationMergeRename
public static final OutputProfiler.Strategy SeparationMergeRename
PDF/A-2 and later require that the same color definition is used for each Separation plate in the PDF. This leads to problems when one color is defined twice using two different colors. This strategy will simply rename different one of the separations. As Acrobat has its own resolution approach, this will lead to different results if the PDF is relying on Acrobat's resolution being applied. But the results will, at least, be predictable across all PDF viewers, and different separations will not result in rasterization. This strategy will be ignored ifSeparationMergeAcrobat
is set.
-
ConvertAttachments
public static final OutputProfiler.Strategy ConvertAttachments
PDF/A-2 and later permit attachments but only if the attachments are themselves valid PDF/A-2 documents. This strategy will attempt to convert the attachment to PDF/A-2.
-
RepairToUnicodeCodeLength
public static final OutputProfiler.Strategy RepairToUnicodeCodeLength
The ToUnicode map, used to give meaning to glyphs in the PDF, is sometimes created in a particular way (with two-byte codes where single-bye are requried) that means it must be ignored by Acrobat. It's relatively easy to repair this, and usually it's the right thing to do. Occasionally the ToUnicode map is completely incorrect and repairing it means the text no long extracts correctly. There's no way to know this, and it depends on the document. On average, with relatively modern documents, we find that repairing it is more likely to help than to break things, so this is on by default.- Since:
- 2.26.1
-
PartialPage
public static final OutputProfiler.Strategy PartialPage
Whether it's preferable to return a partially rendered page (if unrecoverable damage was found while rasterizing it), as opposed to failing. Depending on the damage this could result in anything from a 99% complete page to a blank page. This is a "strategy of last resort", and will only be used when the alternative is failure with an error- Since:
- 2.26.3
-
RemoveReaderExtensions
public static final OutputProfiler.Strategy RemoveReaderExtensions
Strategy that will remove reader-extensions, if that's what's required to match the target OutputProfile.- Since:
- 2.26.3
-
OverprintICCtoDevice
public static final OutputProfiler.Strategy OverprintICCtoDevice
When overprinting is disallowed in CMYK ICC profiles, as it is for PDF/A-2 and later, we have two choices. First we can rasterize the page, which is the policy used prior to the introduction of this feature. Second, we can convert the CMYK color from the ICC ColorSpace that's specified to the Output Intent CMYK ColorSpace. This may result in a color shift, but rasterization almost certainly will as well. Overall, we think that rasterization is the greater evil, so this is turned on by default.- Since:
- 2.27
-
JustFixIt
public static final OutputProfiler.Strategy JustFixIt
Strategy that will do whatever it takes to make the PDF match the target OutputProfile, removing whatever it takes to get there.
-
-
Method Detail
-
values
public static OutputProfiler.Strategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (OutputProfiler.Strategy c : OutputProfiler.Strategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static OutputProfiler.Strategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getValue
public long getValue()
Return the numeric value for this strategy. In general this will have a single bit set - the used strategy is the logical "or" of all the strategies. The exceptions to this areDefault
, which has a value of 0, andJustFixIt
which has a value where all the bits are set.- Since:
- 2.26.3
-
-