コード例 #1
0
        /// <summary>
        /// Funzione per l'instanziazione della classe responsabile della conversione
        /// </summary>
        /// <returns>Riferimento all'istanza del convetitore</returns>
        private IPdfConverter GetConverter()
        {
            // Convertitore da restituire
            IPdfConverter toReturn = null;

            // Se non è valorizzato il nome dell'assembly da utilizzare per la conversione,
            // viene lanciata un'eccezione appropriata

            ControlloConverterType();

            // Tramite reflection si prova ad istanziare la classe del convertitore
            try
            {
                // Recupero del tipo di convertitore a partire dal nome dell'assembly
                Type type = Type.GetType(_converterType, true, true);
                logger.Debug(String.Format("tipo convertitore: {0} versione {1}", type.Assembly.FullName, type.Assembly.ImageRuntimeVersion));

                // Creazione dell'istanza
                toReturn = (IPdfConverter)Activator.CreateInstance(type);
            }
            catch (Exception ex)
            {
                // Rilancio dell'eccezione ai livelli superiori
                logger.Error(String.Format("Errore: {0} \r\n {1}", ex.Message, ex.StackTrace));
                if (ex.InnerException != null)
                {
                    logger.Error(string.Format("Errore interno {0} \r\n {1}", ex.InnerException.Message, ex.InnerException.StackTrace));
                }

                throw new EngineInitializationException(ex);
            }

            // Restituzione dell'istanza del convertitore
            return(toReturn);
        }
コード例 #2
0
ファイル: PdfResult.cs プロジェクト: krreddy123/appcode
        public PdfResult(IPdfConverter converter, PdfConvertSettings settings)
        {
            Guard.NotNull(converter, nameof(converter));

            this.Converter = converter;
            this.Settings  = settings ?? new PdfConvertSettings();
        }
コード例 #3
0
 public InvoiceApiController(IRepository <Order> orderRepository, IWorkContext workContext, IRazorViewRenderer viewRender, IPdfConverter pdfConverter)
 {
     _orderRepository = orderRepository;
     _workContext     = workContext;
     _viewRender      = viewRender;
     _pdfConverter    = pdfConverter;
 }
コード例 #4
0
        /// <summary>
        /// Funzione per l'inizializzazione del motore di conversione
        /// </summary>
        private void Initialize()
        {
            // Inizializzazione del mutex e del convertitore solo se il
            // non è stato già inizializzato.
            // Inizialmente il thread non deve possedere il mutex
            if (_mutex == null)
            {
                // Lettura del valori salvati nella configurazione
                this.ReadConfiguration();
                this._mutexId = ConfigurationManager.AppSettings["INSTANCE_ID"];


                if (_mutexId.Equals("$RANDOMIZE$"))
                {
                    _mutexId = Guid.NewGuid().ToString();
                }

                logger.DebugFormat("MutexID: CONVERTER_ENGINE_MUTEX{0}", _mutexId);
                _mutex        = new Mutex(false, String.Format("CONVERTER_ENGINE_MUTEX{0}", _mutexId));
                _pdfConverter = this.GetConverter();

                // Interpretazione dei tipi di file accettati per la conversione
                this.InitializeFileTypeCollection();
            }
        }
コード例 #5
0
ファイル: PdfResult.cs プロジェクト: devil1510/SmartStore
        public PdfResult(IPdfConverter converter, PdfConvertSettings settings)
        {
            Guard.ArgumentNotNull(() => converter);

            this.Converter = converter;
            this.Settings  = settings ?? new PdfConvertSettings();
        }
コード例 #6
0
		public PdfResult(IPdfConverter converter, PdfConvertSettings settings)
		{
			Guard.ArgumentNotNull(() => converter);
			
			this.Converter = converter;
			this.Settings = settings ?? new PdfConvertSettings();
		}
コード例 #7
0
ファイル: ReferralsService.cs プロジェクト: ytqsl/embc-ess
 public ReferralsService(IDataInterface dataInterface, IPdfConverter pdfConverter, ICurrentUser currentUser, IHostingEnvironment environment)
 {
     this.dataInterface = dataInterface;
     this.pdfConverter  = pdfConverter;
     this.userService   = currentUser;
     this.env           = environment;
 }
コード例 #8
0
 public ConvertToPdfController(
     IHtmlToPdfDocumentGenerator htmlToPdfDocumentGenerator,
     IPdfConverter pdfConverter)
 {
     _recyclableMemoryStreamManager = new RecyclableMemoryStreamManager();
     _htmlToPdfDocumentGenerator    = htmlToPdfDocumentGenerator;
     _pdfConverter = pdfConverter;
 }
コード例 #9
0
 public HomeController(
     ILogger <HomeController> logger,
     IEmployee employee,
     IPdfConverter pdfConverter)
 {
     _logger       = logger;
     _employee     = employee;
     _pdfConverter = pdfConverter;
 }
コード例 #10
0
 public WebApiPdfHelper(
     ICommonServices services,
     IPdfConverter pdfConverter,
     OrderHelper orderHelper)
 {
     _services     = services;
     _pdfConverter = pdfConverter;
     _orderHelper  = orderHelper;
 }
コード例 #11
0
        /// <summary>
        /// Verifica se il convertitore corrente supporta ocr
        /// </summary>
        public static bool OcrSupported()
        {
            bool retValue = false;

            if (ConvertInlineActive())
            {
                IPdfConverter converter = GetConverter();
                retValue = converter.OcrSupported;
            }

            return(retValue);
        }
コード例 #12
0
        /// <summary>
        /// Conversione in PDF mediante il convertitore correntemente impostato
        /// </summary>
        /// <param name="filePath"></param>
        /// <param name="outPdfFilePath"></param>
        /// <param name="recognizeText"></param>
        /// <returns></returns>
        public static bool Convert(string filePath, string outPdfFilePath, bool recognizeText)
        {
            logger.Debug(string.Format("INIT - BusinessLogic.Documenti.PdfConverter.Convert(filePath: '{0}', outPdfFilePath: '{1}', recognizeText: '{2}')",
                                       filePath, outPdfFilePath, recognizeText));

            bool retValue = false;

            try
            {
                if (CurrentMutex.WaitOne())
                {
                    // Se la conversione è attiva e se il file può essere convertito
                    if (CanConvertFile(filePath))
                    {
                        IPdfConverter converter = GetConverter();

                        if (converter != null)
                        {
                            retValue = converter.Convert(filePath, outPdfFilePath, recognizeText);
                        }
                        else
                        {
                            throw new ApplicationException("Convertitore PDF inline non istanziato, impossibile effettuare la conversione del documento");
                        }
                    }
                    else
                    {
                        logger.Debug("Conversione PDF inline non supportata per il formato del documento");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Debug(ex);

                throw new ApplicationException("Errore nella conversione PDF inline del documento", ex);
            }
            finally
            {
                CurrentMutex.ReleaseMutex();

                if (CurrentMutex != null)
                {
                    CurrentMutex.Close();
                    _mutex = null;
                }

                logger.Debug("END - BusinessLogic.Documenti.PdfConverter.Convert");
            }

            return(retValue);
        }
コード例 #13
0
 public ProductsController(Dispatcher dispatcher,
                           ILogger <ProductsController> logger,
                           IHtmlGenerator htmlGenerator,
                           IPdfConverter pdfConverter,
                           ICsvWriter <ProductModel> productCsvWriter,
                           ICsvReader <ProductModel> productCsvReader)
 {
     _dispatcher       = dispatcher;
     _logger           = logger;
     _htmlGenerator    = htmlGenerator;
     _pdfConverter     = pdfConverter;
     _productCsvWriter = productCsvWriter;
     _productCsvReader = productCsvReader;
 }
コード例 #14
0
 public OrderController(
     IOrderService orderService,
     IShipmentService shipmentService,
     ICurrencyService currencyService,
     IPriceFormatter priceFormatter,
     IOrderProcessingService orderProcessingService,
     IDateTimeHelper dateTimeHelper,
     IPaymentService paymentService,
     IPdfConverter pdfConverter,
     IShippingService shippingService,
     ICountryService countryService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IStoreService storeService,
     IProductService productService,
     IProductAttributeFormatter productAttributeFormatter,
     PluginMediator pluginMediator,
     ICommonServices services,
     IQuantityUnitService quantityUnitService,
     ProductUrlHelper productUrlHelper,
     IProductAttributeParser productAttributeParser,
     IPictureService pictureService,
     CatalogSettings catalogSettings,
     MediaSettings mediaSettings,
     ShoppingCartSettings shoppingCartSettings)
 {
     this._orderService               = orderService;
     this._shipmentService            = shipmentService;
     this._currencyService            = currencyService;
     this._priceFormatter             = priceFormatter;
     this._orderProcessingService     = orderProcessingService;
     this._dateTimeHelper             = dateTimeHelper;
     this._paymentService             = paymentService;
     this._pdfConverter               = pdfConverter;
     this._shippingService            = shippingService;
     this._countryService             = countryService;
     this._productService             = productService;
     this._productAttributeFormatter  = productAttributeFormatter;
     this._storeService               = storeService;
     this._checkoutAttributeFormatter = checkoutAttributeFormatter;
     this._pluginMediator             = pluginMediator;
     this._services               = services;
     this._quantityUnitService    = quantityUnitService;
     this._productUrlHelper       = productUrlHelper;
     this._pictureService         = pictureService;
     this._catalogSettings        = catalogSettings;
     this._productAttributeParser = productAttributeParser;
     this._mediaSettings          = mediaSettings;
     this._shoppingCartSettings   = shoppingCartSettings;
 }
コード例 #15
0
        /// <summary>
        /// Creazione istanza oggetto convertitore in pdf
        /// </summary>
        /// <returns></returns>
        private static IPdfConverter GetConverter()
        {
            if (_converter == null && !string.IsNullOrEmpty(_converterType))
            {
                try
                {
                    Type type = Type.GetType(_converterType, true, true);

                    _converter = (IPdfConverter)Activator.CreateInstance(type);
                }
                catch (Exception ex)
                {
                    logger.Debug(string.Format("PdfConverter.CreateConverter: errore nella creazione dell'oggetto convertitore '{0}'", _converterType), ex);
                }
            }

            return(_converter);
        }
コード例 #16
0
 public OrderController(
     IOrderService orderService,
     IShipmentService shipmentService,
     ICurrencyService currencyService,
     IPriceFormatter priceFormatter,
     IOrderProcessingService orderProcessingService,
     IDateTimeHelper dateTimeHelper,
     IPaymentService paymentService,
     IPdfConverter pdfConverter,
     IShippingService shippingService,
     ICountryService countryService,
     ICheckoutAttributeFormatter checkoutAttributeFormatter,
     IStoreService storeService,
     IProductService productService,
     IProductAttributeFormatter productAttributeFormatter,
     IProductAttributeParser productAttributeParser,
     Lazy <IPictureService> pictureService,
     PluginMediator pluginMediator,
     ICommonServices services,
     IQuantityUnitService quantityUnitService)
 {
     this._orderService               = orderService;
     this._shipmentService            = shipmentService;
     this._currencyService            = currencyService;
     this._priceFormatter             = priceFormatter;
     this._orderProcessingService     = orderProcessingService;
     this._dateTimeHelper             = dateTimeHelper;
     this._paymentService             = paymentService;
     this._pdfConverter               = pdfConverter;
     this._shippingService            = shippingService;
     this._countryService             = countryService;
     this._productService             = productService;
     this._productAttributeFormatter  = productAttributeFormatter;
     this._productAttributeParser     = productAttributeParser;
     this._storeService               = storeService;
     this._checkoutAttributeFormatter = checkoutAttributeFormatter;
     this._pluginMediator             = pluginMediator;
     this._services            = services;
     this._quantityUnitService = quantityUnitService;
 }
コード例 #17
0
        public OrderController(
			IOrderService orderService, 
            IShipmentService shipmentService,
            ICurrencyService currencyService, 
			IPriceFormatter priceFormatter,
            IOrderProcessingService orderProcessingService, 
			IDateTimeHelper dateTimeHelper,
            IPaymentService paymentService,
			IPdfConverter pdfConverter, 
			IShippingService shippingService,
            ICountryService countryService,
            ICheckoutAttributeFormatter checkoutAttributeFormatter,
			IStoreService storeService,
			IProductService productService,
			IProductAttributeFormatter productAttributeFormatter,
			Lazy<IPictureService> pictureService,
			PluginMediator pluginMediator,
			ICommonServices services,
            IQuantityUnitService quantityUnitService)
        {
            this._orderService = orderService;
            this._shipmentService = shipmentService;
            this._currencyService = currencyService;
            this._priceFormatter = priceFormatter;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._paymentService = paymentService;
			this._pdfConverter = pdfConverter;
            this._shippingService = shippingService;
            this._countryService = countryService;
			this._productService = productService;
			this._productAttributeFormatter = productAttributeFormatter;
			this._storeService = storeService;
            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
			this._pluginMediator = pluginMediator;
			this._services = services;
            this._quantityUnitService = quantityUnitService;
			T = NullLocalizer.Instance;
        }
コード例 #18
0
ファイル: OrderController.cs プロジェクト: krreddy123/appcode
 public OrderController(
     IDateTimeHelper dateTimeHelper,
     IPdfConverter pdfConverter,
     ProductUrlHelper productUrlHelper,
     OrderHelper orderHelper,
     IOrderService orderService,
     IShipmentService shipmentService,
     IOrderProcessingService orderProcessingService,
     IPaymentService paymentService,
     IShippingService shippingService,
     ICountryService countryService)
 {
     _dateTimeHelper         = dateTimeHelper;
     _pdfConverter           = pdfConverter;
     _productUrlHelper       = productUrlHelper;
     _orderHelper            = orderHelper;
     _orderService           = orderService;
     _shipmentService        = shipmentService;
     _orderProcessingService = orderProcessingService;
     _paymentService         = paymentService;
     _shippingService        = shippingService;
     _countryService         = countryService;
 }
コード例 #19
0
 public ReferralsService(IDataInterface dataInterface, IPdfConverter pdfConverter)
 {
     this.dataInterface = dataInterface;
     this.pdfConverter  = pdfConverter;
 }
コード例 #20
0
 public HtmlToPdfController(IPdfConverter pdfConverter)
 {
     _pdfConverter = pdfConverter;
 }
コード例 #21
0
        public OrderController(IOrderService orderService, 
            IOrderReportService orderReportService, IOrderProcessingService orderProcessingService,
            IDateTimeHelper dateTimeHelper, IPriceFormatter priceFormatter, ILocalizationService localizationService,
            IWorkContext workContext, ICurrencyService currencyService,
            IEncryptionService encryptionService, IPaymentService paymentService,
            IMeasureService measureService,
            IAddressService addressService, ICountryService countryService,
            IStateProvinceService stateProvinceService, IProductService productService,
            IExportManager exportManager, IPermissionService permissionService,
            IWorkflowMessageService workflowMessageService,
            ICategoryService categoryService, IManufacturerService manufacturerService,
            IProductAttributeService productAttributeService, IProductAttributeParser productAttributeParser,
            IProductAttributeFormatter productAttributeFormatter, IShoppingCartService shoppingCartService,
            ICheckoutAttributeFormatter checkoutAttributeFormatter, 
            IGiftCardService giftCardService, IDownloadService downloadService,
			IShipmentService shipmentService, IStoreService storeService,
			ITaxService taxService,
			IPriceCalculationService priceCalculationService,
			IEventPublisher eventPublisher,
			ICustomerService customerService,
			PluginMediator pluginMediator,
			IAffiliateService affiliateService,
            CatalogSettings catalogSettings, CurrencySettings currencySettings, TaxSettings taxSettings,
            MeasureSettings measureSettings, PdfSettings pdfSettings, AddressSettings addressSettings,
            IPdfConverter pdfConverter, ICommonServices services, Lazy<IPictureService> pictureService)
        {
            this._orderService = orderService;
            this._orderReportService = orderReportService;
            this._orderProcessingService = orderProcessingService;
            this._dateTimeHelper = dateTimeHelper;
            this._priceFormatter = priceFormatter;
            this._localizationService = localizationService;
            this._workContext = workContext;
            this._currencyService = currencyService;
            this._encryptionService = encryptionService;
            this._paymentService = paymentService;
            this._measureService = measureService;
            this._addressService = addressService;
            this._countryService = countryService;
            this._stateProvinceService = stateProvinceService;
            this._productService = productService;
            this._exportManager = exportManager;
            this._permissionService = permissionService;
            this._workflowMessageService = workflowMessageService;
            this._categoryService = categoryService;
            this._manufacturerService = manufacturerService;
            this._productAttributeService = productAttributeService;
            this._productAttributeParser = productAttributeParser;
            this._productAttributeFormatter = productAttributeFormatter;
            this._shoppingCartService = shoppingCartService;
            this._giftCardService = giftCardService;
            this._downloadService = downloadService;
            this._shipmentService = shipmentService;
            this._storeService = storeService;
            this._taxService = taxService;
            this._priceCalculationService = priceCalculationService;
            this._eventPublisher = eventPublisher;
            this._customerService = customerService;
            this._pluginMediator = pluginMediator;
            this._affiliateService = affiliateService;

            this._catalogSettings = catalogSettings;
            this._currencySettings = currencySettings;
            this._taxSettings = taxSettings;
            this._measureSettings = measureSettings;
            this._pdfSettings = pdfSettings;
            this._addressSettings = addressSettings;

            this._checkoutAttributeFormatter = checkoutAttributeFormatter;
            _pdfConverter = pdfConverter;
            _services = services;
            _pictureService = pictureService;
        }
コード例 #22
0
 public PdfResult(IPdfConverter converter, PdfConvertSettings settings)
 {
     this.Converter = converter;
     this.Settings  = settings ?? new PdfConvertSettings();
 }
コード例 #23
0
 public PdfService(IPdfConverter pdfConverter)
 {
     this.pdfConverter = pdfConverter;
     //this.hostEnvironment = hostEnvironment;
 }
コード例 #24
0
 public PdfController(IPdfConverter converter)
 {
     _converter = converter;
 }