I'm using Freespire.Office and get a font parsing exception error on the SaveToFile line, but only if I'm also using the code below to check if there are images. If I comment that block out, or close the document and reopen it after the for loop, I don't get the error.
doc.LoadFromFile(FileWithPath);
foreach (PdfPageBase p in doc.Pages)
{
Image[] images = p.ExtractImages();
if (images != null && images.Length > 0)
HasPicture = true;
}
doc.SaveToFile(DOCX, Spire.Pdf.FileFormat.DOCX);
spr㍎
HResult=0x80131600
Message=Font parsing exception
Source=Spire.Pdf
StackTrace:
at spr㌚.ᜀ(spr㌃ A_0)
at spr㊼.ᜀ(spr㌃ A_0)
at spr㊼.ᜀ(spr㊳ A_0, spr㌇ A_1)
at sprⴥ.ᜐ()
at sprⱩ.ᜀ(spr㜃 A_0)
at Spire.Pdf.PdfDocumentBase.ᜂ(Int32 A_0, Boolean A_1)
at spr㰂.ᜀ(PdfDocumentBase A_0, Int32 A_1)
at spr㰂.ᜀ(PdfDocumentBase A_0, Stream A_1, Int32 A_2, Int32 A_3)
at spr㰂.ᜂ(PdfDocumentBase A_0, Stream A_1, Int32 A_2, Int32 A_3)
at spr㰂.ᜀ(PdfDocumentBase A_0, Stream A_1)
at Spire.Pdf.PdfDocumentBase.ᜀ(String A_0, Boolean A_1)
at Spire.Pdf.PdfDocumentBase.Save(String fileName, FileFormat fileformat)
at Spire.Pdf.PdfDocument.SaveToFile(String filename, FileFormat fileFormat)
at MessageConverter.worker.InterrogatePDF(String FileWithPath) in C:\development\MessageConverter\MessageConverter\worker.cs:line 32
at MessageConverter.Program.Main(String[] args) in C:\development\MessageConverter\MessageConverter\Program.cs:line 17
Inner Exception 1:
ArgumentNullException: Buffer cannot be null.
I have it working, but it means I have to close it and re-open it to save it as another format.