private static ZugferdConformanceLevel GetZugferdConformanceLevel(ZugferdProperties properties) { ZugferdConformanceLevel?local = properties.zugferdConformanceLevel; if (local != null) { return(local.Value); } else { LogManager.GetLogger(typeof(ZugferdDocument)).Warn(ZugferdLogMessageConstant.NO_ZUGFERD_PROFILE_TYPE_SPECIFIED); return(ZugferdConformanceLevel.ZUGFeRDBasic); } }
private static PdfAConformanceLevel GetPdfAConformanceLevel(ZugferdProperties properties) { PdfAConformanceLevel local = properties.pdfaConformanceLevel; if (local != null) { return(local); } else { LogManager.GetLogger(typeof(ZugferdDocument)).Warn(ZugferdLogMessageConstant.WRONG_OR_NO_CONFORMANCE_LEVEL); return(PdfAConformanceLevel.PDF_A_3B); } }
/// <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()); }