Free Support Forum - aspose.com

ArgumentOutOfRangeException when saving word document as PDF

Hi to verybody at the support team,

the attached word document throws an exception when saved as PDF.

Aspose.Words 9.7.0
.net Framework 2.0

If the old version Aspose.Words 9.5.0 is used, everything works fine.

Best regards, Martin Pfeifer

=================== stack trace ===================
Der Index und die Länge müssen sich auf eine Position in der Zeichenfolge beziehen.\r\nParametername: length"} System.Exception {System.ArgumentOutOfRangeException}
StackTrace " bei System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
bei Aspose.Words.Run.x4ede2f7ca43a1460(Int32 xd4f974c06ffa392b, Int32 x961016a387451f05, Boolean x1e2b473fecc8c6b6)
bei x28925c9b27b37a46.xb56968f92e308c8a.x64ae56857b252b27(xe83a6b069ec8efc2 xcbf24c118ac8aa0b, Boolean xdd2a9ff3a1da2f60)
bei x28925c9b27b37a46.x0a28863c804404d7.xb3491b205d3b163a()
bei x28925c9b27b37a46.x0a28863c804404d7.x452863527147987d()
bei x28925c9b27b37a46.x0a28863c804404d7.OnChildNode()
bei x28925c9b27b37a46.xce798d32ec270dda.x267efc5f6ada2866()
bei x28925c9b27b37a46.x0a28863c804404d7.x775521112ede5e6f(x7e263f21a73a027a x5f36ad26e64b91c3, Node x98cacf1c34b53cca, xe83a6b069ec8efc2 xcbf24c118ac8aa0b)
bei xfbd1009a0cbb9842.x54b0ce4be209efe2.ApplyResultCore()
bei xfbd1009a0cbb9842.xf83652aff352c801.x7d44c41f397d72e0()
bei xfbd1009a0cbb9842.xca592a476766b11a.xb333e1e6c01c2be2()
bei Aspose.Words.Fields.Field.x295cb4a1df7a5add(x5e36356bc92c609b x0f7b23d1c393aed9)
bei Aspose.Words.Fields.Field.xda55dc11084967d0(xdac068096ca09318 xb4edacb3d605f604)
bei x4adf554d20d941a6.x5c28fdcd27dee7d9.x295cb4a1df7a5add(Field xe01ae93d9fe5a880)
bei x4adf554d20d941a6.x5c28fdcd27dee7d9.x295cb4a1df7a5add()
bei x59d6a4fc5007b7a4.xcde671c53995c411.x836cc4d43484aecd(xac6c82c74ce247fb x2612f62f94df47de)
bei x59d6a4fc5007b7a4.xcde671c53995c411.x84448f134fcddce5(x398b3bd0acd94b61 xd7e5673853e47af4, Hashtable x9883c720593ff2cd)
bei x59d6a4fc5007b7a4.xcde671c53995c411.x17e48e42e094d16c(xeefdffd909e695da xc3f0a044e1e9f77f)
bei x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651)
bei Aspose.Words.Document.UpdatePageLayout()
bei Aspose.Words.Document.x410db0f4a89a6ef1(Boolean x24af0daafcd8fb8c)
bei Aspose.Words.Document.get_xcde671c53995c411()
bei Aspose.Words.Document.get_PageCount()\r\n bei xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2)
bei Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
bei Aspose.Words.Document.Save(String fileName, SaveOptions saveOptions)
bei de.egov.AsposeDcs.Wrapper.WordDocumentWrapper.SaveAsPdf_work(DocumentWrapper objDestDoc, PdfCompliance pdfConformance, Boolean bTransformBookmarks2PdfBookmarks, Boolean bTransformHeadings2PdfBookmarks)

=================== example project ===================

namespace WordTest
{
class Program
{
static void Main(string[] args)
{
Test_SaveAsPdf(“c:\CVSHOME\ccDcs2\ccDcsDllTest\res\Word16.doc”);
Test_SaveAsPng(“c:\CVSHOME\ccDcs2\ccDcsDllTest\res\Word16.doc”);
}

private static void Test_SaveAsPdf(string strSourceFile)
{
string strDestFile = Path.ChangeExtension(strSourceFile, “pdf”);

if (File.Exists(strDestFile))
{
File.Delete(strDestFile);
}

// Loading document causes exception …
LoadOptions lOpt = new LoadOptions(LoadFormat.Doc, null, null);
Aspose.Words.Document currDoc = new Aspose.Words.Document(strSourceFile, lOpt);

currDoc.ShadeFormData = false;

PdfSaveOptions pdfSaveOpt = (PdfSaveOptions)Aspose.Words.Saving.SaveOptions.CreateSaveOptions(Aspose.Words.SaveFormat.Pdf);
pdfSaveOpt.Compliance = PdfCompliance.Pdf15;
pdfSaveOpt.BookmarksOutlineLevel = 3;
pdfSaveOpt.HeadingsOutlineLevels = 3;
pdfSaveOpt.SaveFormat = Aspose.Words.SaveFormat.Pdf;

SaveOutputParameters savedOutput = currDoc.Save(strDestFile, pdfSaveOpt);
}
}
}

bugid#4059

A fix for the issue(s) you've reported (filed as 24503) will be released in the next release at the end of this month. You will be notified.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-4429) have been fixed in this .NET update and in this Java update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.