Good day, I am developing a feature which download excel based on the pdf layout set using iText. A byte[] data is generated from the iText which in this form "����hp�" if I Console.WriteLine it in LineEncoding.UTF8.GetString.
I want to load the byte[] data in pdf form, into Stream then convert it into excel using Spire library. So the user can download the excel with pdf layout without download and convert the pdf. Thank you for helping me!
//byte[] data which contained pdf layout using iText
byte[] pdfData = _PDFService.CreatePDF(a, b);
//Create Stream
MemoryStream pdfStream = new MemoryStream();
//Write Stream with byte[] data
pdfStream.Write(pdfData, 0, pdfData.Length);
pdfStream.Position = 0;
//Create a PdfDocument instance
PdfDocument document = new PdfDocument();
//Load from Stream
document.LoadFromStream(pdfStream);
//Save to Excel
document.SaveToFile(@"C:\Users\...\output.xlsx", FileFormat.XLSX);
Console output:
Unhandled exception rendering component: The type initializer for 'spr⥪' threw an exception.
System.TypeInitializationException: The type initializer for 'spr⥪' threw an exception.