public static void Init(IPDFHandler handler, ICustomFontProvider customFontProvider = null) { if (Instance == null) { Instance = new PDFManager(); } if (handler == null) { throw new ArgumentNullException("IPDFHandler"); } GlobalFontSettings.FontResolver = new FontProvider(customFontProvider); ImageSource.ImageSourceImpl = handler?.GetImageSource(); Instance.Handler = handler; Instance.Renderers = new Dictionary <Type, Type>(); //register all predefined renderers var assembly = typeof(PDFManager).GetTypeInfo().Assembly; foreach (var typeInfo in assembly.DefinedTypes) { if (typeInfo.IsDefined(typeof(Attributes.PdfRendererAttribute), false)) { var rInfo = typeInfo.GetCustomAttribute <Attributes.PdfRendererAttribute>(); if (Instance.Renderers.ContainsKey(rInfo.ViewType)) { Instance.Renderers[rInfo.ViewType] = typeInfo.AsType(); } else { Instance.Renderers.Add(rInfo.ViewType, typeInfo.AsType()); } } } }