本文整理汇总了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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
}
示例7: AsposeConverter
public AsposeConverter()
{
License license = new License();
license.SetLicense("Aspose.Total.lic");
}
示例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");
}
}
示例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();
}
示例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();
}
示例11: SetLicense
/// <summary>
/// Sets the license.
/// </summary>
public override void SetLicense()
{
License license = new License();
license.SetLicense(AttachmentResources.LicenseFileName);
}