Hi Team
We are creating PDF using ASP.Net Core 6. Its throwing runtime error. Any clues?
I have written a sample as below:
==
using GroupDocs.Assembly;
using GroupDocs.Assembly.Data;
namespace GroupDocsConversionSample
{
internal class Program
{
static void Main(string[] args)
{
try
{
string productJsonFilePath = Path.Combine(Path.GetFullPath(@"../../../GroupDocsPackageLicense"), "Product.json");
string productPdfpath = Path.Combine(Path.GetFullPath(@"../../../GroupDocsPackageLicense"), "ProductData.pdf");
string productTemplete = Path.Combine(Path.GetFullPath(@"../../../GroupDocsPackageLicense"), "Product.html");
string groupDocslicensePath = Path.Combine(Path.GetFullPath(@"../../../GroupDocsPackageLicense"), "GroupDocs.Conversion.NET.lic");
// Reading the groupDocs license key
using (FileStream groupDocsfileStream = System.IO.File.Open(groupDocslicensePath, FileMode.Open, FileAccess.Read))
{
GroupDocs.Conversion.License groupDocslicense = new GroupDocs.Conversion.License();
groupDocslicense.SetLicense(groupDocsfileStream);
}
// Instantiate JSON data source
JsonDataSource productJsonDataSource = new JsonDataSource(productJsonFilePath);
// Generate Product PDF File
DocumentAssembler assembler = new DocumentAssembler(); //Here here UseReflectionOptimization is not set due to version issue
assembler.AssembleDocument(productTemplete,
productPdfpath,
new DataSourceInfo(productJsonDataSource, "ProductData"));
}
catch (Exception exception)
{
Console.WriteLine(exception.ToString());
}
}
}
}
Regards
Krishna