Esempio n. 1
0
        /// <summary>Adds the ZUGFeRD RDF description.</summary>
        /// <param name="xmpMeta">the xmp meta</param>
        /// <param name="zugferdConformanceLevel">the zugferd conformance level</param>
        /// <exception cref="iText.Kernel.XMP.XMPException">the XMP exception</exception>
        private void AddZugferdRdfDescription(XMPMeta xmpMeta, ZugferdConformanceLevel zugferdConformanceLevel)
        {
            switch (zugferdConformanceLevel)
            {
            case ZugferdConformanceLevel.ZUGFeRDBasic:
            case ZugferdConformanceLevel.ZUGFeRDComfort:
            case ZugferdConformanceLevel.ZUGFeRDExtended: {
                // fallthrough
                // fallthrough
                XMPMeta taggedExtensionMetaComfort = XMPMetaFactory.ParseFromString(GetZugferdExtension(zugferdConformanceLevel
                                                                                                        ));
                XMPUtils.AppendProperties(taggedExtensionMetaComfort, xmpMeta, true, false);
                break;
            }

            default: {
                break;
            }
            }
        }
Esempio n. 2
0
        /// <summary>Gets the ZUGFeRD extension.</summary>
        /// <param name="conformanceLevel">the conformance level</param>
        /// <returns>the ZUGFeRD extension</returns>
        private String GetZugferdExtension(ZugferdConformanceLevel conformanceLevel)
        {
            switch (conformanceLevel)
            {
            case ZugferdConformanceLevel.ZUGFeRDBasic: {
                return(MessageFormatUtil.Format(ZugferdXMPUtil.ZUGFERD_EXTENSION, "BASIC"));
            }

            case ZugferdConformanceLevel.ZUGFeRDComfort: {
                return(MessageFormatUtil.Format(ZugferdXMPUtil.ZUGFERD_EXTENSION, "COMFORT"));
            }

            case ZugferdConformanceLevel.ZUGFeRDExtended: {
                return(MessageFormatUtil.Format(ZugferdXMPUtil.ZUGFERD_EXTENSION, "EXTENDED"));
            }

            default: {
                return(null);
            }
            }
        }
Esempio n. 3
0
        /// <summary>Creates a ZUGFeRD document with the passed ZUGFeRD conformance level, PDF/A conformance level and output intent using the passed writer.
        ///     </summary>
        /// <param name="writer">Writer to output the PDF</param>
        /// <param name="zugferdConformanceLevel">ZUGFeRD conformance level, one of  the following: BASIC, COMFORT or EXTENDED
        ///     </param>
        /// <param name="pdfaConformanceLevel">PDF/A conformance level</param>
        /// <param name="outputIntent">PDF/A output intent for the document.</param>
        public ZugferdDocument(PdfWriter writer, ZugferdConformanceLevel zugferdConformanceLevel, PdfAConformanceLevel
                               pdfaConformanceLevel, PdfOutputIntent outputIntent)
            : base(writer, pdfaConformanceLevel, outputIntent)
        {
            String licenseKeyClassName        = "iText.License.LicenseKey, itext.licensekey";
            String licenseKeyProductClassName = "iText.License.LicenseKeyProduct, itext.licensekey";
            String licenseKeyFeatureClassName = "iText.License.LicenseKeyProductFeature, itext.licensekey";
            String checkLicenseKeyMethodName  = "ScheduledCheck";
            Type   licenseKeyClass            = GetClass(licenseKeyClassName);

            if (licenseKeyClass != null)
            {
                Type       licenseKeyProductClass        = GetClass(licenseKeyProductClassName);
                Type       licenseKeyProductFeatureClass = GetClass(licenseKeyFeatureClassName);
                Array      array         = Array.CreateInstance(licenseKeyProductFeatureClass, 0);
                object[]   objects       = new object[] { "pdfInvoice", 1, 0, array };
                Object     productObject = System.Activator.CreateInstance(licenseKeyProductClass, objects);
                MethodInfo m             = licenseKeyClass.GetMethod(checkLicenseKeyMethodName);
                m.Invoke(System.Activator.CreateInstance(licenseKeyClass), new object[] { productObject });
            }
            this.zugferdConformanceLevel = zugferdConformanceLevel;
        }
Esempio n. 4
0
        /// <summary>Creates a ZUGFeRD document with the passed ZUGFeRD conformance level, PDF/A conformance level and output intent using the passed writer.
        ///     </summary>
        /// <param name="writer">Writer to output the PDF</param>
        /// <param name="properties">ZUGFeRD properties.</param>
        public ZugferdDocument(PdfWriter writer, ZugferdProperties properties)
            : base(writer, GetPdfAConformanceLevel(properties), properties.pdfOutputIntent, new DocumentProperties().SetEventCountingMetaInfo(new ZugferdMetaInfo()))
        {
            String licenseKeyClassName        = "iText.License.LicenseKey, itext.licensekey";
            String licenseKeyProductClassName = "iText.License.LicenseKeyProduct, itext.licensekey";
            String licenseKeyFeatureClassName = "iText.License.LicenseKeyProductFeature, itext.licensekey";
            String checkLicenseKeyMethodName  = "ScheduledCheck";

            try {
                Type licenseKeyClass = GetClass(licenseKeyClassName);
                if (licenseKeyClass != null)
                {
                    Type     licenseKeyProductClass        = GetClass(licenseKeyProductClassName);
                    Type     licenseKeyProductFeatureClass = GetClass(licenseKeyFeatureClassName);
                    Array    array   = Array.CreateInstance(licenseKeyProductFeatureClass, 0);
                    object[] objects = new object[]
                    {
                        ZugferdProductInfo.PRODUCT_NAME,
                        ZugferdProductInfo.MAJOR_VERSION,
                        ZugferdProductInfo.MINOR_VERSION,
                        array
                    };
                    Object     productObject = System.Activator.CreateInstance(licenseKeyProductClass, objects);
                    MethodInfo m             = licenseKeyClass.GetMethod(checkLicenseKeyMethodName);
                    m.Invoke(System.Activator.CreateInstance(licenseKeyClass), new object[] { productObject });
                }
            }
            catch (Exception) {
                if (!Kernel.Version.IsAGPLVersion())
                {
                    throw;
                }
            }
            this.zugferdConformanceLevel = GetZugferdConformanceLevel(properties);
            EventCounterHandler.GetInstance().OnEvent(PdfInvoiceEvent.DOCUMENT, properties.metaInfo, GetType());
        }
Esempio n. 5
0
        /// <summary>Creates a ZUGFeRD document with the passed ZUGFeRD conformance level and output intent using the passed writer.
        ///     </summary>
        /// <remarks>Creates a ZUGFeRD document with the passed ZUGFeRD conformance level and output intent using the passed writer. The PdfAConformanceLevel will be set to PDF/A-3B.
        ///     </remarks>
        /// <param name="writer">Writer to output the pdf</param>
        /// <param name="zugferdConformanceLevel">ZUGFeRD conformance level, BASIC, COMFORT or EXTENDED</param>
        /// <param name="outputIntent">Pdf/A output intent for the document</param>
        public ZugferdDocument(PdfWriter writer, ZugferdConformanceLevel zugferdConformanceLevel, PdfOutputIntent
                               outputIntent)
            : this(writer, zugferdConformanceLevel, PdfAConformanceLevel.PDF_A_3B, outputIntent)
        {
            String licenseKeyClassName        = "iText.License.LicenseKey, itext.licensekey";
            String licenseKeyProductClassName = "iText.License.LicenseKeyProduct, itext.licensekey";
            String licenseKeyFeatureClassName = "iText.License.LicenseKeyProductFeature, itext.licensekey";
            String checkLicenseKeyMethodName  = "ScheduledCheck";
            Type   licenseKeyClass            = GetClass(licenseKeyClassName);

            if (licenseKeyClass != null)
            {
                Type       licenseKeyProductClass        = GetClass(licenseKeyProductClassName);
                Type       licenseKeyProductFeatureClass = GetClass(licenseKeyFeatureClassName);
                Array      array         = Array.CreateInstance(licenseKeyProductFeatureClass, 0);
                object[]   objects       = new object[] { "pdfInvoice", 1, 0, array };
                Object     productObject = System.Activator.CreateInstance(licenseKeyProductClass, objects);
                MethodInfo m             = licenseKeyClass.GetMethod(checkLicenseKeyMethodName);
                m.Invoke(System.Activator.CreateInstance(licenseKeyClass), new object[] { productObject });
            }
            ILog logger = LogManager.GetLogger(typeof(iText.Zugferd.ZugferdDocument));

            logger.Warn(ZugferdLogMessageConstant.WRONG_OR_NO_CONFORMANCE_LEVEL);
        }
Esempio n. 6
0
 /// <summary>Creates a ZUGFeRD document with the passed ZUGFeRD conformance level and output intent using the passed writer.
 ///     </summary>
 /// <remarks>Creates a ZUGFeRD document with the passed ZUGFeRD conformance level and output intent using the passed writer. The PdfAConformanceLevel will be set to PDF/A-3B.
 ///     </remarks>
 /// <param name="writer">Writer to output the pdf</param>
 /// <param name="zugferdConformanceLevel">ZUGFeRD conformance level, BASIC, COMFORT or EXTENDED</param>
 /// <param name="outputIntent">Pdf/A output intent for the document</param>
 public ZugferdDocument(PdfWriter writer, ZugferdConformanceLevel zugferdConformanceLevel, PdfOutputIntent outputIntent)
     : this(writer, new ZugferdProperties().SetZugferdConformanceLevel(zugferdConformanceLevel).SetPdfOutputIntent(outputIntent))
 {
 }