Package com.pd4ml

Class PdfSpec


  • public final class PdfSpec
    extends java.lang.Object
    A PDF output specification: a PDF version, optionally combined with conformance to PDF/A (archiving), PDF/UA (accessibility) or an e-invoice format. Pass it to PD4ML.writePDF(java.io.OutputStream, PdfSpec).

    Start from a PDF version constant and add standards with combine(PdfSpec):

    
     pd4ml.writePDF(os, PdfSpec.PDF_1_7);                                   // plain PDF 1.7
     pd4ml.writePDF(os, PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_3B));          // PDF/A-3b
     pd4ml.writePDF(os, PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_2A)
                                       .combine(PdfSpec.PDFUA_1));          // PDF/A-2a + PDF/UA-1
     pd4ml.writePDF(os, PdfSpec.ZUGFeRD);                                   // ZUGFeRD invoice
     
    Each PDF/A part requires a minimum PDF version: PDF 1.4 for PDF/A-1, PDF 1.7 for PDF/A-2 and PDF/A-3, PDF 2.0 for PDF/A-4. PDF/UA-1 requires PDF 1.4, PDF/UA-2 requires PDF 2.0. PDF/UA can only be combined with the accessible "a" level of PDF/A-1 to PDF/A-3, and PDF/UA-2 not with PDF/A-1 to PDF/A-3 at all. Instances are immutable; combine(PdfSpec) returns a new one.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static PdfSpec FacturX
      Factur-X electronic invoice profile: PDF 1.7 and PDF/A-3b.
      static PdfSpec FacturX_a
      Factur-X electronic invoice profile, tagged: PDF 1.7 and PDF/A-3a.
      int id
      The internal identifier: 100 to 200 for PDF versions (PDF 1.4 is 140), 1 to 22 for PDF/A and PDF/UA.
      java.lang.String name
      The name of the specification, for example "1.7" or "PDF/A-3b"; see toString().
      static PdfSpec PDF_1_0
      PDF 1.0 / Acrobat 1.
      static PdfSpec PDF_1_1
      PDF 1.1 / Acrobat 2.
      static PdfSpec PDF_1_2
      PDF 1.2 / Acrobat 3.
      static PdfSpec PDF_1_3
      PDF 1.3 / Acrobat 4.
      static PdfSpec PDF_1_4
      PDF 1.4 / Acrobat 5.
      static PdfSpec PDF_1_5
      PDF 1.5 / Acrobat 6
      static PdfSpec PDF_1_6
      PDF 1.6 / Acrobat 7
      static PdfSpec PDF_1_7
      PDF 1.7 / Acrobat 8 / ISO 32000-1.
      static PdfSpec PDF_1_7_1
      PDF 1.7 unofficial ext level 1
      static PdfSpec PDF_1_7_10
      PDF 1.7 unofficial ext level 10
      static PdfSpec PDF_1_7_11
      PDF 1.7 extension level 11 / Acrobat XI
      static PdfSpec PDF_1_7_2
      PDF 1.7 unofficial ext level 2
      static PdfSpec PDF_1_7_3
      PDF 1.7 extension level 3 / Acrobat 9
      static PdfSpec PDF_1_7_4
      PDF 1.7 unofficial ext level 4
      static PdfSpec PDF_1_7_5
      PDF 1.7 extension level 5
      static PdfSpec PDF_1_7_6
      PDF 1.7 unofficial ext level 6
      static PdfSpec PDF_1_7_7
      PDF 1.7 unofficial ext level 7
      static PdfSpec PDF_1_7_8
      PDF 1.7 extension level 8 / Acrobat X
      static PdfSpec PDF_1_7_9
      PDF 1.7 unofficial ext level 9
      static PdfSpec PDF_2_0
      PDF 2.0 / ISO 32000-2
      static PdfSpec PDFA_1A
      PDF/A-1a (ISO 19005-1, level a): archivable and accessible; tagged structure and Unicode text required; no transparency.
      static PdfSpec PDFA_1B
      PDF/A-1b (ISO 19005-1, level b): archivable with a reliable visual appearance; no transparency.
      static PdfSpec PDFA_2A
      PDF/A-2a (ISO 19005-2, level a): archivable and accessible; tagged structure and Unicode text required.
      static PdfSpec PDFA_2B
      PDF/A-2b (ISO 19005-2, level b): archivable with a reliable visual appearance.
      static PdfSpec PDFA_2U
      PDF/A-2u (ISO 19005-2, level u): like PDF/A-2b, plus Unicode text that can be extracted reliably.
      static PdfSpec PDFA_3A
      PDF/A-3a (ISO 19005-3, level a): like PDF/A-2a, and allows embedded files of any type.
      static PdfSpec PDFA_3B
      PDF/A-3b (ISO 19005-3, level b): like PDF/A-2b, and allows embedded files of any type.
      static PdfSpec PDFA_3U
      PDF/A-3u (ISO 19005-3, level u): like PDF/A-2u, and allows embedded files of any type.
      static PdfSpec PDFA_4
      PDF/A-4 (ISO 19005-4), based on PDF 2.0.
      static PdfSpec PDFA_4E
      PDF/A-4e (ISO 19005-4), for engineering documents, based on PDF 2.0.
      static PdfSpec PDFUA_1
      PDF/UA-1 (ISO 14289-1): universally accessible PDF, for example for screen readers; a tagged structure is generated.
      static PdfSpec PDFUA_2
      PDF/UA-2 (ISO 14289-2), based on PDF 2.0.
      int xid
      The internal bit mask of the PDF/A and PDF/UA standards included.
      static PdfSpec ZUGFeRD
      ZUGFeRD electronic invoice profile: PDF 1.7 and PDF/A-3b.
      static PdfSpec ZUGFeRD_a
      ZUGFeRD electronic invoice profile, tagged: PDF 1.7 and PDF/A-3a.
    • Constructor Summary

      Constructors 
      Constructor Description
      PdfSpec​(PdfSpec spec)
      Creates the specification of the PDF version a given specification needs: a PDF version is copied; for a PDF/A or PDF/UA constant, the result is the lowest PDF version that standard allows, combined with the standard.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allowsAttachments()
      Tells whether the specification allows embedded files attached to the content (not allowed by PDF/A-1 and PDF/A-2).
      boolean allowsDocLevelAttachments()
      Tells whether the specification allows files embedded at document level, as used by e-invoices (allowed by PDF/A-3 and PDF 2.0).
      boolean allowsEncryption()
      Tells whether the specification allows encryption (not allowed by PDF/A).
      boolean allowsExternalHyperlinking()
      Tells whether the specification allows links to external resources.
      boolean allowsPdfForms()
      Tells whether PD4ML generates interactive form fields for this specification (not for PDF/A).
      boolean allowsTransparency()
      Tells whether the specification allows transparency (not allowed by PDF/A-1).
      static boolean areCompatible​(PdfSpec pdf, PdfSpec pdfa1, PdfSpec pdfa2)
      Checks whether a PDF version and up to two PDF/A or PDF/UA standards can be combined: PDF/A-4 needs PDF 1.7 or later, and PDF/UA-2 cannot be combined with PDF/A-1 to PDF/A-3.
      PdfSpec combine​(PdfSpec spec)
      Returns a new specification that adds a PDF/A or PDF/UA standard to this one.
      static PdfSpec getByID​(int id)
      Finds a PDF/A or PDF/UA constant by its id.
      static PdfSpec getByLabel​(java.lang.String label)
      Finds a PDF version by its version number.
      static PdfSpec getInstance​(java.lang.String label)
      Finds a specification constant by its name, as returned by toString(), ignoring case: for example "1.4", "1.7ext3", "PDF/A-3b", "PDF/UA-1" or "Factur-X".
      int getPdfaVersion()
      Returns the PDF/A part the specification includes.
      int getPdfExtLevel()
      Returns the Adobe extension level of a PDF 1.7 specification.
      int getPdfuaVersion()
      Returns the PDF/UA part of a PDF/UA constant (PDFUA_1 or PDFUA_2).
      java.lang.String getPdfVersionLabel()
      Returns the PDF version of a version specification, without the extension level.
      boolean isPdfa()
      Tells whether the specification includes any PDF/A part and level.
      boolean isPdfa1()
      Tells whether the specification includes PDF/A-1 (level a or b).
      boolean isPdfa12()
      Tells whether the specification includes PDF/A-1 or PDF/A-2 (any level).
      boolean isPdfa123()
      Tells whether the specification includes PDF/A-1, PDF/A-2 or PDF/A-3 (any level).
      boolean isPdfa1234()
      Tells whether the specification includes any PDF/A part from 1 to 4.
      boolean isPdfa123a()
      Tells whether the specification includes PDF/A-1a, PDF/A-2a or PDF/A-3a.
      boolean isPdfa123b()
      Tells whether the specification includes PDF/A-1b, PDF/A-2b or PDF/A-3b.
      boolean isPdfa12a()
      Tells whether the specification includes PDF/A-1a or PDF/A-2a.
      boolean isPdfa1a()
      Tells whether the specification includes PDF/A-1a.
      boolean isPdfa1b()
      Tells whether the specification includes PDF/A-1b.
      boolean isPdfa2()
      Tells whether the specification includes PDF/A-2 (any level).
      boolean isPdfa23()
      Tells whether the specification includes PDF/A-2 or PDF/A-3 (any level).
      boolean isPdfa234()
      Tells whether the specification includes PDF/A-2, PDF/A-3 or PDF/A-4.
      boolean isPdfa23a()
      Tells whether the specification includes PDF/A-2a or PDF/A-3a.
      boolean isPdfa23b()
      Tells whether the specification includes PDF/A-2b or PDF/A-3b.
      boolean isPdfa23u()
      Tells whether the specification includes PDF/A-2u or PDF/A-3u.
      boolean isPdfa2u()
      Tells whether the specification includes PDF/A-2u.
      boolean isPdfa3()
      Tells whether the specification includes PDF/A-3 (any level).
      boolean isPdfa4()
      Tells whether the specification includes PDF/A-4 (any variant).
      boolean isPdfa4e()
      Tells whether the specification includes PDF/A-4e.
      boolean isPdfa4f()
      Tells whether the specification includes PDF/A-4f (not supported yet).
      boolean isPdfua()
      Tells whether the specification includes PDF/UA-1 or PDF/UA-2.
      boolean isPdfua1()
      Tells whether the specification includes PDF/UA-1.
      boolean isPdfua2()
      Tells whether the specification includes PDF/UA-2.
      static java.lang.String listKeywords()
      Lists the names of the supported specifications from PDF 1.4 on, for help texts: PDF versions are prefixed with "PDF" (for example 'PDF1.7'), the others are listed as they are (for example 'PDF/A-3b').
      boolean requiresColorspace()
      Tells whether the specification requires a device-independent color space or output intent for the colors used.
      boolean requiresMetadata()
      Tells whether the specification requires XMP metadata (PDF/A and PDF/UA).
      boolean requiresOutputInternet()
      Tells whether the specification requires an output intent (PDF/A and PDF/UA).
      boolean requiresReliableUnicodeSemantics()
      Tells whether the specification requires every glyph to map to Unicode text (PDF/A-1).
      boolean requiresTagging()
      Tells whether the specification requires a tagged PDF with a logical structure tree (PDF/A-1a, -2a, -3a and PDF/UA).
      java.lang.String toString()
      Returns the name of the specification, for example "1.7", "PDF/A-3b" or "ZUGFeRD".
      PdfSpec withMinimumVersion​(PdfSpec version)
      Returns a specification with at least the given PDF version, keeping the PDF/A and PDF/UA standards of this one.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • PDF_1_0

        public static final PdfSpec PDF_1_0
        PDF 1.0 / Acrobat 1. Obsolete; not supported for output.
      • PDF_1_1

        public static final PdfSpec PDF_1_1
        PDF 1.1 / Acrobat 2. Obsolete; not supported for output.
      • PDF_1_2

        public static final PdfSpec PDF_1_2
        PDF 1.2 / Acrobat 3. Obsolete; not supported for output.
      • PDF_1_3

        public static final PdfSpec PDF_1_3
        PDF 1.3 / Acrobat 4. Obsolete; not supported for output.
      • PDF_1_4

        public static final PdfSpec PDF_1_4
        PDF 1.4 / Acrobat 5. The lowest version supported for output.
      • PDF_1_5

        public static final PdfSpec PDF_1_5
        PDF 1.5 / Acrobat 6
      • PDF_1_6

        public static final PdfSpec PDF_1_6
        PDF 1.6 / Acrobat 7
      • PDF_1_7

        public static final PdfSpec PDF_1_7
        PDF 1.7 / Acrobat 8 / ISO 32000-1. The default output version.
      • PDF_1_7_1

        public static final PdfSpec PDF_1_7_1
        PDF 1.7 unofficial ext level 1
      • PDF_1_7_2

        public static final PdfSpec PDF_1_7_2
        PDF 1.7 unofficial ext level 2
      • PDF_1_7_3

        public static final PdfSpec PDF_1_7_3
        PDF 1.7 extension level 3 / Acrobat 9
      • PDF_1_7_4

        public static final PdfSpec PDF_1_7_4
        PDF 1.7 unofficial ext level 4
      • PDF_1_7_5

        public static final PdfSpec PDF_1_7_5
        PDF 1.7 extension level 5
      • PDF_1_7_6

        public static final PdfSpec PDF_1_7_6
        PDF 1.7 unofficial ext level 6
      • PDF_1_7_7

        public static final PdfSpec PDF_1_7_7
        PDF 1.7 unofficial ext level 7
      • PDF_1_7_8

        public static final PdfSpec PDF_1_7_8
        PDF 1.7 extension level 8 / Acrobat X
      • PDF_1_7_9

        public static final PdfSpec PDF_1_7_9
        PDF 1.7 unofficial ext level 9
      • PDF_1_7_10

        public static final PdfSpec PDF_1_7_10
        PDF 1.7 unofficial ext level 10
      • PDF_1_7_11

        public static final PdfSpec PDF_1_7_11
        PDF 1.7 extension level 11 / Acrobat XI
      • PDF_2_0

        public static final PdfSpec PDF_2_0
        PDF 2.0 / ISO 32000-2
      • PDFA_1A

        public static final PdfSpec PDFA_1A
        PDF/A-1a (ISO 19005-1, level a): archivable and accessible; tagged structure and Unicode text required; no transparency. Requires PDF 1.4 or later.
      • PDFA_1B

        public static final PdfSpec PDFA_1B
        PDF/A-1b (ISO 19005-1, level b): archivable with a reliable visual appearance; no transparency. Requires PDF 1.4 or later.
      • PDFA_2A

        public static final PdfSpec PDFA_2A
        PDF/A-2a (ISO 19005-2, level a): archivable and accessible; tagged structure and Unicode text required. Requires PDF 1.7.
      • PDFA_2B

        public static final PdfSpec PDFA_2B
        PDF/A-2b (ISO 19005-2, level b): archivable with a reliable visual appearance. Requires PDF 1.7.
      • PDFA_2U

        public static final PdfSpec PDFA_2U
        PDF/A-2u (ISO 19005-2, level u): like PDF/A-2b, plus Unicode text that can be extracted reliably. Requires PDF 1.7.
      • PDFA_3A

        public static final PdfSpec PDFA_3A
        PDF/A-3a (ISO 19005-3, level a): like PDF/A-2a, and allows embedded files of any type. Requires PDF 1.7.
      • PDFA_3B

        public static final PdfSpec PDFA_3B
        PDF/A-3b (ISO 19005-3, level b): like PDF/A-2b, and allows embedded files of any type. Requires PDF 1.7.
      • PDFA_3U

        public static final PdfSpec PDFA_3U
        PDF/A-3u (ISO 19005-3, level u): like PDF/A-2u, and allows embedded files of any type. Requires PDF 1.7.
      • PDFA_4

        public static final PdfSpec PDFA_4
        PDF/A-4 (ISO 19005-4), based on PDF 2.0. Requires PDF 2.0.
      • PDFA_4E

        public static final PdfSpec PDFA_4E
        PDF/A-4e (ISO 19005-4), for engineering documents, based on PDF 2.0. Requires PDF 2.0.
      • PDFUA_1

        public static final PdfSpec PDFUA_1
        PDF/UA-1 (ISO 14289-1): universally accessible PDF, for example for screen readers; a tagged structure is generated. Combine it with a PDF version from 1.4 on, optionally also with PDF/A-1a, -2a or -3a.
      • PDFUA_2

        public static final PdfSpec PDFUA_2
        PDF/UA-2 (ISO 14289-2), based on PDF 2.0. Requires PDF 2.0; cannot be combined with PDF/A-1 to PDF/A-3.
      • ZUGFeRD

        public static final PdfSpec ZUGFeRD
        ZUGFeRD electronic invoice profile: PDF 1.7 and PDF/A-3b. Use it directly, without combine(PdfSpec).
      • ZUGFeRD_a

        public static final PdfSpec ZUGFeRD_a
        ZUGFeRD electronic invoice profile, tagged: PDF 1.7 and PDF/A-3a. Use it directly, without combine(PdfSpec).
      • FacturX

        public static final PdfSpec FacturX
        Factur-X electronic invoice profile: PDF 1.7 and PDF/A-3b. Use it directly, without combine(PdfSpec).
      • FacturX_a

        public static final PdfSpec FacturX_a
        Factur-X electronic invoice profile, tagged: PDF 1.7 and PDF/A-3a. Use it directly, without combine(PdfSpec).
      • name

        public java.lang.String name
        The name of the specification, for example "1.7" or "PDF/A-3b"; see toString().
      • id

        public int id
        The internal identifier: 100 to 200 for PDF versions (PDF 1.4 is 140), 1 to 22 for PDF/A and PDF/UA.
      • xid

        public int xid
        The internal bit mask of the PDF/A and PDF/UA standards included.
    • Constructor Detail

      • PdfSpec

        public PdfSpec​(PdfSpec spec)
                throws PdfSpec.PdfSpecViolationException,
                       PdfSpec.PdfSpecUnsupportedException
        Creates the specification of the PDF version a given specification needs: a PDF version is copied; for a PDF/A or PDF/UA constant, the result is the lowest PDF version that standard allows, combined with the standard. For example, new PdfSpec(PdfSpec.PDFA_3B) is equivalent to PdfSpec.PDF_1_7.combine(PdfSpec.PDFA_3B).
        Parameters:
        spec - a PDF version, PDF/A or PDF/UA constant
        Throws:
        PdfSpec.PdfSpecViolationException - declared for compatibility; not thrown by this constructor
        PdfSpec.PdfSpecUnsupportedException - if spec is a PDF version before 1.4, or is not a known version or standard
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns the name of the specification, for example "1.7", "PDF/A-3b" or "ZUGFeRD". For a combined specification, the name of the PDF version it is based on.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the name
      • combine

        public PdfSpec combine​(PdfSpec spec)
                        throws PdfSpec.PdfSpecViolationException,
                               PdfSpec.PdfSpecUnsupportedException
        Returns a new specification that adds a PDF/A or PDF/UA standard to this one. This object is not changed.

        Allowed combinations: a PDF version with one PDF/A part and level, a PDF version with PDF/UA, and a PDF version with PDF/UA and an "a" level of PDF/A-1 to PDF/A-3. The PDF version must be high enough for the standard (see the class description).

        Parameters:
        spec - the PDF/A or PDF/UA standard to add
        Returns:
        the combined specification
        Throws:
        PdfSpec.PdfSpecViolationException - if the combination is not allowed: spec is a PDF version (the version cannot be changed), the PDF version is too low for spec, a PDF/A level is already set, or PDF/UA would be combined with a PDF/A level other than "a"
        PdfSpec.PdfSpecUnsupportedException - if spec is a PDF version before 1.4
      • withMinimumVersion

        public PdfSpec withMinimumVersion​(PdfSpec version)
        Returns a specification with at least the given PDF version, keeping the PDF/A and PDF/UA standards of this one. This object is not changed.
        Parameters:
        version - a PDF version constant, for example PDF_1_6
        Returns:
        this object if its PDF version is already high enough, a raised copy otherwise
      • isPdfa

        public boolean isPdfa()
        Tells whether the specification includes any PDF/A part and level.
        Returns:
        true if it does
      • isPdfa1

        public boolean isPdfa1()
        Tells whether the specification includes PDF/A-1 (level a or b).
        Returns:
        true if it does
      • isPdfa1a

        public boolean isPdfa1a()
        Tells whether the specification includes PDF/A-1a.
        Returns:
        true if it does
      • isPdfa1b

        public boolean isPdfa1b()
        Tells whether the specification includes PDF/A-1b.
        Returns:
        true if it does
      • isPdfa2

        public boolean isPdfa2()
        Tells whether the specification includes PDF/A-2 (any level).
        Returns:
        true if it does
      • isPdfa3

        public boolean isPdfa3()
        Tells whether the specification includes PDF/A-3 (any level).
        Returns:
        true if it does
      • isPdfa12

        public boolean isPdfa12()
        Tells whether the specification includes PDF/A-1 or PDF/A-2 (any level).
        Returns:
        true if it does
      • isPdfa12a

        public boolean isPdfa12a()
        Tells whether the specification includes PDF/A-1a or PDF/A-2a.
        Returns:
        true if it does
      • isPdfa2u

        public boolean isPdfa2u()
        Tells whether the specification includes PDF/A-2u.
        Returns:
        true if it does
      • isPdfa123

        public boolean isPdfa123()
        Tells whether the specification includes PDF/A-1, PDF/A-2 or PDF/A-3 (any level).
        Returns:
        true if it does
      • isPdfa123a

        public boolean isPdfa123a()
        Tells whether the specification includes PDF/A-1a, PDF/A-2a or PDF/A-3a.
        Returns:
        true if it does
      • isPdfa23

        public boolean isPdfa23()
        Tells whether the specification includes PDF/A-2 or PDF/A-3 (any level).
        Returns:
        true if it does
      • isPdfa23a

        public boolean isPdfa23a()
        Tells whether the specification includes PDF/A-2a or PDF/A-3a.
        Returns:
        true if it does
      • isPdfa23b

        public boolean isPdfa23b()
        Tells whether the specification includes PDF/A-2b or PDF/A-3b.
        Returns:
        true if it does
      • isPdfa23u

        public boolean isPdfa23u()
        Tells whether the specification includes PDF/A-2u or PDF/A-3u.
        Returns:
        true if it does
      • isPdfa123b

        public boolean isPdfa123b()
        Tells whether the specification includes PDF/A-1b, PDF/A-2b or PDF/A-3b.
        Returns:
        true if it does
      • isPdfa4e

        public boolean isPdfa4e()
        Tells whether the specification includes PDF/A-4e.
        Returns:
        true if it does
      • isPdfa4f

        public boolean isPdfa4f()
        Tells whether the specification includes PDF/A-4f (not supported yet).
        Returns:
        true if it does
      • isPdfa4

        public boolean isPdfa4()
        Tells whether the specification includes PDF/A-4 (any variant).
        Returns:
        true if it does
      • isPdfa1234

        public boolean isPdfa1234()
        Tells whether the specification includes any PDF/A part from 1 to 4.
        Returns:
        true if it does
      • isPdfa234

        public boolean isPdfa234()
        Tells whether the specification includes PDF/A-2, PDF/A-3 or PDF/A-4.
        Returns:
        true if it does
      • isPdfua

        public boolean isPdfua()
        Tells whether the specification includes PDF/UA-1 or PDF/UA-2.
        Returns:
        true if it does
      • isPdfua1

        public boolean isPdfua1()
        Tells whether the specification includes PDF/UA-1.
        Returns:
        true if it does
      • isPdfua2

        public boolean isPdfua2()
        Tells whether the specification includes PDF/UA-2.
        Returns:
        true if it does
      • allowsTransparency

        public boolean allowsTransparency()
        Tells whether the specification allows transparency (not allowed by PDF/A-1).
        Returns:
        true if transparency is allowed
      • allowsAttachments

        public boolean allowsAttachments()
        Tells whether the specification allows embedded files attached to the content (not allowed by PDF/A-1 and PDF/A-2).
        Returns:
        true if attachments are allowed
      • allowsDocLevelAttachments

        public boolean allowsDocLevelAttachments()
        Tells whether the specification allows files embedded at document level, as used by e-invoices (allowed by PDF/A-3 and PDF 2.0).
        Returns:
        true if document-level attachments are allowed
      • allowsEncryption

        public boolean allowsEncryption()
        Tells whether the specification allows encryption (not allowed by PDF/A).
        Returns:
        true if encryption is allowed
      • allowsPdfForms

        public boolean allowsPdfForms()
        Tells whether PD4ML generates interactive form fields for this specification (not for PDF/A).
        Returns:
        true if form fields are allowed
      • requiresTagging

        public boolean requiresTagging()
        Tells whether the specification requires a tagged PDF with a logical structure tree (PDF/A-1a, -2a, -3a and PDF/UA).
        Returns:
        true if tagging is required
      • requiresColorspace

        public boolean requiresColorspace()
        Tells whether the specification requires a device-independent color space or output intent for the colors used.
        Returns:
        true if a color space definition is required
      • requiresMetadata

        public boolean requiresMetadata()
        Tells whether the specification requires XMP metadata (PDF/A and PDF/UA).
        Returns:
        true if XMP metadata is required
      • requiresOutputInternet

        public boolean requiresOutputInternet()
        Tells whether the specification requires an output intent (PDF/A and PDF/UA). The method name is kept for compatibility.
        Returns:
        true if an output intent is required
      • allowsExternalHyperlinking

        public boolean allowsExternalHyperlinking()
        Tells whether the specification allows links to external resources. Always true.
        Returns:
        true
      • requiresReliableUnicodeSemantics

        public boolean requiresReliableUnicodeSemantics()
        Tells whether the specification requires every glyph to map to Unicode text (PDF/A-1).
        Returns:
        true if a Unicode mapping is required
      • getPdfVersionLabel

        public java.lang.String getPdfVersionLabel()
        Returns the PDF version of a version specification, without the extension level.
        Returns:
        the version, for example "1.4", "1.7" (also for the 1.7 extension levels) or "2.0"; not meaningful for the PDF/A and PDF/UA constants
      • getPdfExtLevel

        public int getPdfExtLevel()
        Returns the Adobe extension level of a PDF 1.7 specification.
        Returns:
        the extension level (for example 3 for PDF_1_7_3), or 0 for other versions
      • getPdfaVersion

        public int getPdfaVersion()
        Returns the PDF/A part the specification includes.
        Returns:
        1, 2, 3 or 4, or 0 if it does not include PDF/A
      • getPdfuaVersion

        public int getPdfuaVersion()
        Returns the PDF/UA part of a PDF/UA constant (PDFUA_1 or PDFUA_2). For a combined specification use isPdfua1() and isPdfua2().
        Returns:
        1 or 2, or 0 if this is not a PDF/UA constant
      • areCompatible

        public static boolean areCompatible​(PdfSpec pdf,
                                            PdfSpec pdfa1,
                                            PdfSpec pdfa2)
        Checks whether a PDF version and up to two PDF/A or PDF/UA standards can be combined: PDF/A-4 needs PDF 1.7 or later, and PDF/UA-2 cannot be combined with PDF/A-1 to PDF/A-3. The other rules applied by combine(PdfSpec) are not checked.
        Parameters:
        pdf - the PDF version, or null
        pdfa1 - the first standard, or null
        pdfa2 - the second standard, or null
        Returns:
        false if the combination is known to be invalid
      • getByLabel

        public static PdfSpec getByLabel​(java.lang.String label)
        Finds a PDF version by its version number.
        Parameters:
        label - a version number with three characters, for example "1.4" or "2.0"
        Returns:
        the matching PDF version constant, or PDF_1_7 if the label is null or unknown
      • getInstance

        public static PdfSpec getInstance​(java.lang.String label)
        Finds a specification constant by its name, as returned by toString(), ignoring case: for example "1.4", "1.7ext3", "PDF/A-3b", "PDF/UA-1" or "Factur-X".
        Parameters:
        label - the name
        Returns:
        the matching constant, or PDF_1_7 if the name is null or unknown
      • getByID

        public static PdfSpec getByID​(int id)
        Finds a PDF/A or PDF/UA constant by its id.
        Parameters:
        id - the identifier, from 1 to 22
        Returns:
        the matching constant, or null if there is none
      • listKeywords

        public static java.lang.String listKeywords()
        Lists the names of the supported specifications from PDF 1.4 on, for help texts: PDF versions are prefixed with "PDF" (for example 'PDF1.7'), the others are listed as they are (for example 'PDF/A-3b').
        Returns:
        the names, each in single quotes, separated by spaces