当前位置: 首页>>代码示例>>C#>>正文


C# License.SetLicense方法代码示例

本文整理汇总了C#中License.SetLicense方法的典型用法代码示例。如果您正苦于以下问题:C# License.SetLicense方法的具体用法?C# License.SetLicense怎么用?C# License.SetLicense使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在License的用法示例。


在下文中一共展示了License.SetLicense方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Application_Start

        protected void Application_Start()
        {
            //Register areas
            AreaRegistration.RegisterAllAreas();

            //Set license
            License license = new License();
            license.SetLicense(@".\..\..\licenses\GroupDocs.Comparison.lic");

            //Register filters
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);

            //Create comparison settings
            var comparisonSettings = new ComparisonWidgetSettings
            {
                //Set root storage path
                RootStoragePath = Server.MapPath("~/App_Data/"),
                //Set comparison behavior
                ComparisonBehavior =
                {
                    StyleChangeDetection = true,
                    GenerateSummaryPage = true
                },
                //Set license for Viewer
                LicensePath = @".\..\..\licenses\GroupDocs.Viewer.lic"
            };

            //Initiate comparison widget
            ComparisonWidget.Init(comparisonSettings);
            //Register routes
            RouteConfig.RegisterRoutes(RouteTable.Routes, comparisonSettings);
            //Bundle scripts
            BundleConfigurator.Configure(comparisonSettings);
        }
开发者ID:groupdocs-comparison,项目名称:groupdocs-comparison-net-sample,代码行数:34,代码来源:Global.asax.cs

示例2: SetLicense

        /// <summary>
        /// Sets the license.
        /// </summary>
        public override void SetLicense()
        {
            License license = new License();
            license.SetLicense(AttachmentResources.LicenseFileName);

            Aspose.Pdf.License pdfLicense = new Aspose.Pdf.License();
            pdfLicense.SetLicense(AttachmentResources.LicenseFileName);
        }
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:11,代码来源:WordDocumentProcessor.cs

示例3: LeitorAsposeCells

 /// <summary>
 /// Constroi um leitor com a licença já configurada
 /// </summary>
 public LeitorAsposeCells()
 {
     var assembly = Assembly.GetExecutingAssembly();
     License license = new License();
     using (Stream stream = assembly.GetManifestResourceStream("Carubbi.Excel.Assets.Aspose.Total.lic"))
     {
         license.SetLicense(stream);           
     }
 }
开发者ID:rcarubbi,项目名称:Carubbi.Components,代码行数:12,代码来源:LeitorAsposeCells.cs

示例4: PDF2TextAsposePDFConverter

  /// <summary>
 /// Constroi um objeto recuperando e definindo a licença de uso
 /// </summary>
 public PDF2TextAsposePDFConverter()
 {
     var assembly = Assembly.GetExecutingAssembly();
     License license = new License();
     using (Stream stream = assembly.GetManifestResourceStream("Carubbi.PDF.Assets.Aspose.Total.lic"))
     {
         license.SetLicense(stream);
     }
 }
开发者ID:rcarubbi,项目名称:Carubbi.Components,代码行数:12,代码来源:PDF2TextAsposePDFConverter.cs

示例5: SetAsposeLicense

 /// <summary>
 /// Aspose requires that a valid license file be read before generating any sort of Aspose related content.
 /// A valid license will remove any 'Evaluation' cosmetics and watermarks from the resultant pdfs generated.
 /// NOTE: Depending on your circumstances, setting license.Embedded = true; may not be necessary. 
 /// E.g. If you are making calls to a wcf service that uses this builder, there is no need for the licence to be embedded.
 /// Just call the method before processing (as part of an internal operation) for every call. 
 /// It is recommended you add the Aspose.Pdf.lic to your project in App_Data and have Build Action set to 'Content'.
 /// </summary>
 public static void SetAsposeLicense(string licensePath)
 {
     var license = new License();
     if (!File.Exists(licensePath)) return;
     using (var licenseStream = new FileStream(licensePath, FileMode.Open, FileAccess.Read))
     {
         license.SetLicense(licenseStream);
     }
 }
开发者ID:TheY2T,项目名称:Aspose.Pdf.Builder,代码行数:17,代码来源:PdfBuilderFactory.cs

示例6: OnBeforeTest

        protected override void OnBeforeTest()
        {
            var projectDirectory = GetProjectDirectory();
            var licensePath = Path.Combine(projectDirectory, "Aspose.Words.lic");

            if (File.Exists(licensePath))
            {
                var license = new License();

                try
                {
                    using (var stream = File.OpenRead(licensePath))
                    {
                        license.SetLicense(stream);
                    }

                    HasLicense = true;
                }
                catch
                {
                    HasLicense = false;
                }
            }
        }
开发者ID:vc3,项目名称:ExoMerge,代码行数:24,代码来源:DocumentTestsBase.cs

示例7: AsposeConverter

 public AsposeConverter()
 {
     License license = new License();
     license.SetLicense("Aspose.Total.lic");
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:5,代码来源:AsposeConverter.cs

示例8: ExportButton_Click

        protected void ExportButton_Click(object sender, EventArgs e)
        {
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            if (ExportDataSource != null)
            {
                this.AllowPaging = false;
                this.DataSource = ExportDataSource;
                this.DataBind();
            }

            this.RenderBeginTag(hw);
            this.HeaderRow.RenderControl(hw);
            foreach (GridViewRow row in this.Rows)
            {
                row.RenderControl(hw);
            }
            this.FooterRow.RenderControl(hw);
            this.RenderEndTag(hw);

            string heading = string.IsNullOrEmpty(ExportFileHeading) ? string.Empty : ExportFileHeading;

            string pageSource = "<html><head></head><body>" + heading + sw.ToString() + "</body></html>";

            // Check for license and apply if exists
            if (File.Exists(LicenseFilePath))
            {
                License license = new License();
                license.SetLicense(LicenseFilePath);
            }

            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(pageSource));
            Document doc = new Document(stream);

            WordOutputFormat format;
            if (Enum.TryParse<WordOutputFormat>(ExportOutputFormat.ToString(), out format))
            {
                string extension = ExportOutputFormat.ToString().ToLower();

                if (string.IsNullOrEmpty(extension)) extension = "doc";
                string fileName = System.Guid.NewGuid() + "." + extension;

                if (!string.IsNullOrEmpty(ExportOutputPathOnServer) && Directory.Exists(ExportOutputPathOnServer))
                {
                    try
                    {
                        doc.Save(ExportOutputPathOnServer + "\\" + fileName);
                    }
                    catch (Exception) { }
                }

                if (ExportInLandscape)
                {
                    foreach (Section section in doc)
                        section.PageSetup.Orientation = Orientation.Landscape;
                }

                doc.Save(HttpContext.Current.Response, fileName, ContentDisposition.Inline, null);
                HttpContext.Current.Response.End();
            }
            else
            {
                HttpContext.Current.Response.Write("Invalid export format, must be one of Doc, Dot, Docx, Docm, Dotx, Dotm, Rtf, Odt, Ott, Txt");
            }
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:66,代码来源:ExportableGridView.cs

示例9: ExportButton_Click

        protected void ExportButton_Click(object sender, EventArgs e)
        {
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            hw.RenderBeginTag("table");

            try
            {
                Control HeaderTemplate = this.Controls[0].Controls[0];
                HeaderTemplate.RenderControl(hw);
            }
            catch (Exception)
            { }

            foreach (RepeaterItem rItem in this.Items)
            {
                rItem.RenderControl(hw);
            }
            hw.RenderEndTag();

            string heading = string.IsNullOrEmpty(ExportFileHeading) ? string.Empty : ExportFileHeading;

            string pageSource = "<html><head></head><body>" + heading + sw.ToString() + "</body></html>";

            // Check for license and apply if exists
            if (File.Exists(LicenseFilePath))
            {
                License license = new License();
                license.SetLicense(LicenseFilePath);
            }

            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(pageSource));
            Document doc = new Document(stream);

            string extension = ExportOutputFormat.ToString().ToLower();

            if (string.IsNullOrEmpty(extension)) extension = "doc";
            string fileName = System.Guid.NewGuid() + "." + extension;

            if (!string.IsNullOrEmpty(ExportOutputPathOnServer) && Directory.Exists(ExportOutputPathOnServer))
            {
                try
                {
                    doc.Save(ExportOutputPathOnServer + "\\" + fileName);
                }
                catch (Exception) { }
            }

            if (ExportInLandscape)
            {
                foreach (Section section in doc)
                    section.PageSetup.Orientation = Orientation.Landscape;
            }

            doc.Save(HttpContext.Current.Response, fileName, ContentDisposition.Inline, null);
            HttpContext.Current.Response.End();
        }
开发者ID:joyang1,项目名称:Aspose_Words_NET,代码行数:58,代码来源:ExportableRepeater.cs

示例10: ExportButton_Click

        protected void ExportButton_Click(object sender, EventArgs e)
        {
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            if (ExportDataSource != null)
            {
                this.AllowPaging = false;
                this.DataSource = ExportDataSource;
                this.DataBind();
            }

            this.RenderBeginTag(hw);
            this.HeaderRow.RenderControl(hw);
            foreach (GridViewRow row in this.Rows)
            {
                row.RenderControl(hw);
            }
            this.FooterRow.RenderControl(hw);
            this.RenderEndTag(hw);

            string heading = string.IsNullOrEmpty(ExportFileHeading) ? string.Empty : ExportFileHeading;

            string pageSource = "<html><head></head><body>" + heading + sw.ToString() + "</body></html>";

            // Check for license and apply if exists
            if (File.Exists(LicenseFilePath))
            {
                License license = new License();
                license.SetLicense(LicenseFilePath);
            }

            string fileName = System.Guid.NewGuid() + ".pdf";

            Aspose.Pdf.Document pdf;
            HtmlLoadOptions htmlLoadOptions = new HtmlLoadOptions();
            MemoryStream outputstream = new MemoryStream();
            htmlLoadOptions.InputEncoding = "UTF-8";

            if (ExportInLandscape)
            {
                htmlLoadOptions.PageInfo.Width = 800;
                htmlLoadOptions.PageInfo.Height = 600;
            }

            using (MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(pageSource)))
            {
                pdf = new Document(stream, htmlLoadOptions);
            }

            if (!string.IsNullOrEmpty(ExportOutputPathOnServer) && Directory.Exists(ExportOutputPathOnServer))
            {
                try
                {
                    pdf.Save(ExportOutputPathOnServer + "\\" + fileName);
                }
                catch (Exception) { }
            }

            pdf.Save(outputstream);
            byte[] bytes = outputstream.GetBuffer();
            HttpContext.Current.Response.Clear();
            HttpContext.Current.Response.ContentType = "application/pdf";
            HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" + fileName);
            HttpContext.Current.Response.BinaryWrite(bytes);
            HttpContext.Current.Response.End();
        }
开发者ID:joyang1,项目名称:Aspose_Pdf_NET,代码行数:67,代码来源:ExportableGridView.cs

示例11: SetLicense

 /// <summary>
 /// Sets the license.
 /// </summary>
 public override void SetLicense()
 {
     License license = new License();
     license.SetLicense(AttachmentResources.LicenseFileName);
 }
开发者ID:cgavieta,项目名称:WORKPAC2016-poc,代码行数:8,代码来源:PdfDocumentProcessor.cs


注:本文中的License.SetLicense方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。