Hi i got a problem where some of my files are not recognized by aspose’s Save() method, in short it cant recognize them because they are not valid html files etc. So i want to hardcode the document type so the SaveMethod doesent need to. The code i use today is with static Enum:
public string ConvertDocumentFormat(byte[] document, string fromFormat,string ToFormat)
{
using (MemoryStream docStream = new MemoryStream(document))
{
LoadOptions lo = new LoadOptions();
lo.LoadFormat = LoadFormat.Html;
Document doc = new Document(docStream, lo);
// Save the document as PDF into a stream.
using (MemoryStream pdfStream = new MemoryStream())
{
doc.Save(pdfStream, SaveFormat.Pdf);
// Get base64 string from the resulting stream.
string pdfBase64String = Convert.ToBase64String(pdfStream.ToArray());
return pdfBase64String;
}
}
}
Here i have hardcoded that all documents to the method are of html type. I want to make this more dynamic and use a parameter. How can i do that ?