1

I am using spire.office. It is converting data from excel to pdf successfully but not from the document or RTF file. It is showing the following error Could not load type 'spr᝚' from assembly 'Spire.Doc, Version=7.1.13.41046, Culture=neutral, PublicKeyToken=663f351905198cb3' because it attempts to implement a class as an interface.

Please check it and gives some advice. Thanks in advance

File.WriteAllText(filepath + ".rtf", fileText);
                Document doc = new Document(filepath + ".docx", Spire.Doc.FileFormat.Docx);
                //doc.LoadFromFile(filepath + ".docx",Spire.Doc.FileFormat.Docx);
                doc.SaveToFile(filepath + ".pdf");

2 Answers2

2

When converting files to PDF, you also need to add Spire.Pdf.dll. If not, it might throw that kind of "spr" error. Additionally, you should specify the FileFormat as PDF: doc.SaveToFile(filepath + ".pdf", FileFormat.PDF);

James
  • 69
  • 2
0

Do you load license beforehand?

Spire.License.LicenseProvider.SetLicenseFileName("license.elic.xml");
Spire.License.LicenseProvider.LoadLicense();
Vasiliy Zverev
  • 622
  • 5
  • 10