Spire.Pdf v5.4.9
PdfDocument.SaveToFile(…) throws an 'Unexpected token Unknown before 83178' exception when attempting to save a PDF. The original PDF file is processed via the Spire.PDF API to normalize page sizes, orientation, rotation, margins etc. prior to saving. The original file prior to processing is a valid PDF file, however, the processed file throws the following exception when attempting to save. Thousands of PDF files are processed every day for several months without issue until this exception. Files have been emailed to Spire support.
Spire.Pdf.Exceptions.PdfException
HResult=0x80131500
Message=Unexpected token Unknown before 83178
Source=Spire.Pdf
StackTrace:
at spr៣.ᜀ(ᜀ A_0, String A_1)
at spr៣.ᜀ(TokenType A_0, TokenType A_1)
at spr៣.ᜐ()
at spr៣.ᜀ(Int64 A_0)
at spr៚.ᜀ(spr᜴ A_0)
at spr៝.ᜃ(spr᜴ A_0)
at sprᝣ.ᜂ()
at sprᝣ.ᜀ()
at sprᝣ.ᜁ()
at sprᝣ.ᜀ(spr᜶ A_0)
at spr.ᜄ(spr᜶ A_0)
at spr.ᜀ(spr᜶ A_0, Boolean A_1)
at spr.ᜅ(spr᜶ A_0)
at spr.ᜄ(spr᜶ A_0)
at spr.ᜀ(spr᜶ A_0, Boolean A_1)
at spr.ᜅ(spr᜶ A_0)
at spr.ᜄ(spr᜶ A_0)
at spr.ᜀ(spr᜶ A_0, Boolean A_1)
at sprᝤ.ᜃ(spr᜶ A_0)
at spr៝.ᜀ(spr᜴ A_0, sprᝢ A_1, spr៦ A_2)
at spr៝.ᜀ(spr᜴ A_0, spr៦ A_1)
at spr៝.ᜄ(spr៦ A_0)
at spr៝.ᜅ(spr៦ A_0)
at Spire.Pdf.PdfNewDocument.Save(Stream stream)
at Spire.Pdf.PdfDocumentBase.Save(String filename)
at Spire.Pdf.PdfDocument.SaveToFile(String filename)