We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Rendering of document with image in macrobutton fails with InvalidOperationException

Currently we use Aspose.Words 11.8 and have no problems with the conversion of documents to PDF which have an image inside a macrobutton. We would like to update Aspose.Words to a newer version, because of some other problems that some of our clients reported which are solved in newer versions.


However starting at Aspose.Words 11.9 and all versions beyond that, documents that contain an image inside a macrobutton fail at rendering and cannot be converted to PDF. A document that fails is attached to this post. Note that the document can be openened, for example in the Document Explorer tool, the problem arises when rendering of the document is performed. For example by openening the print preview in the Document Explorer tool or saving the document to PDF.

The problem seems to be in determining the page count.The Document Explorer tool fails at reading the document.PageCount with an InvalidOperationException “Stack empty”:
printDlg.PrinterSettings.MaximumPage = document.PageCount;

Please provide a fix for this problem.

Exception details:
System.InvalidOperationException occurred
Message=Stack empty.
Source=mscorlib
StackTrace:
at System.Collections.Stack.Pop()
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x221bac6efb19ed4e()
at x59d6a4fc5007b7a4.x487cdc969fefe3d6.x47f176deff0d42e2()
at x4adf554d20d941a6.x5c28fdcd27dee7d9.xe481a91e9d1f486d(x7e263f21a73a027a xa955664f4f50999d, x56410a8dd70087c5 x62584df2cb5d40dd, Boolean x9bd63a942c164ecd)
at x4adf554d20d941a6.x5c28fdcd27dee7d9.x57bf52bb3d1c2d43(x56410a8dd70087c5 x62584df2cb5d40dd, x56410a8dd70087c5 x2aa5114a5da7d6c8, x7e263f21a73a027a x9b10ace6509508c0, Boolean x9bd63a942c164ecd)
at x4adf554d20d941a6.x5c28fdcd27dee7d9.x3e04636bf524a4cf(xb9e48f11d7f06ec9 x27f5ecb735ac9676)
at x4adf554d20d941a6.xf0b374f4c0172a4c.x57b3c9e650685d36(x56410a8dd70087c5 x5906905c888d3d98, x56410a8dd70087c5 x62584df2cb5d40dd, x56410a8dd70087c5 x0e990edf4549ee50, Boolean xa17853d20c8c42bd, Boolean x4d2b4f056cf5bb8b)
at x4adf554d20d941a6.xf0b374f4c0172a4c.xf067dcd5f2631e2c(x56410a8dd70087c5 x5906905c888d3d98, Boolean xa17853d20c8c42bd)
at x4adf554d20d941a6.xf0b374f4c0172a4c.x74f5a1ef3906e23c()
at x4adf554d20d941a6.xf0b374f4c0172a4c…ctor(x56410a8dd70087c5 first, x56410a8dd70087c5 after)
at x4adf554d20d941a6.x6d3ade29d016f4ea.x6343dea3b11ed4d8()
at x4adf554d20d941a6.x6d3ade29d016f4ea.x5f6867bc5a977cb1()
at x4adf554d20d941a6.x6d3ade29d016f4ea.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199, Int32 xbfb9ad5ef64f6dc5)
at x4adf554d20d941a6.x20de8d9377d7de69.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199)
at x4adf554d20d941a6.x09e62a55cab70965.x5de571cf1cd1652c(xf6937c72cebe4ad1 x311e7a92306d7199)
at x4adf554d20d941a6.x09e62a55cab70965.xc3819e13f60dd8e6(xf6937c72cebe4ad1 x311e7a92306d7199, Int32 xcd3a9f82634fe5f9)
at x4adf554d20d941a6.x71da84fff8849445.xc3819e13f60dd8e6(x53cb1139c5c64ee6 xd7e5673853e47af4, Int32 xcd3a9f82634fe5f9, Boolean x3175070523842c98)
at x4adf554d20d941a6.x4ddd0723770f9758.xb47a6df2eae4ba51()
at x4adf554d20d941a6.x4ddd0723770f9758.xc3819e13f60dd8e6(x3d1ad8ce75f0db3a xd3311d815ca25f02, Int32 xd284dd7d525c5491, Boolean x3175070523842c98, Boolean x4097fa47409be495)
at x4adf554d20d941a6.x3f7228e953be72ed.xd79114a9e7bc0d9e()
at x4adf554d20d941a6.x3f7228e953be72ed.xc3819e13f60dd8e6(x852fe8bb5ac31098 xe3e287548b3d01f5, Int32 xd284dd7d525c5491)
at x4adf554d20d941a6.x4af2add38e634ad4.xcbc2273143eac9ec(x852fe8bb5ac31098 xb6842aa1e60562e1)
at x4adf554d20d941a6.x4af2add38e634ad4.xc3819e13f60dd8e6(xc7f90d9c7c51cede xbbe2f7d7c86e0379)
at x4adf554d20d941a6.xea876d525d28ff96.xc3819e13f60dd8e6(x398b3bd0acd94b61 xd7e5673853e47af4)
at x4adf554d20d941a6.xac6c82c74ce247fb.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b)
at x4adf554d20d941a6.xa268fdb9ca040dde.xc3819e13f60dd8e6(Boolean xfad304b5f8f3bb5b)
at x4adf554d20d941a6.x4e2f8bff72d83f71.xc3819e13f60dd8e6()
at x59d6a4fc5007b7a4.xcde671c53995c411.xd9db07500873ae98(Document x3664041d21d73fdc, xdeb77ea37ad74c56 xdfde339da46db651)
at Aspose.Words.Document.UpdatePageLayout()
at Aspose.Words.Document.x410db0f4a89a6ef1(Boolean x24af0daafcd8fb8c)
at Aspose.Words.Document.get_xcde671c53995c411()
at Aspose.Words.Document.get_PageCount()
at xf989f31a236ff98c.x6c74398bceb133f8.xa2e0b7f7da663553(x8556eed81191af11 x5ac1382edb7bf2c2)
at Aspose.Words.Document.xf381a641001e6830(Stream xcf18e5243f8d5fd3, String xafe2f3653ee64ebc, SaveOptions xc27f01f21f67608c)
at Aspose.Words.Document.Save(Stream stream, SaveOptions saveOptions)
at IDB.IO.Conversion.Converters.AsposeWordsConverter.Convert(Stream input, String inputType, Stream output, String outputType, Object converterOptions) in d:\Releases\2013.2\DigiOffice\Source.NET\Common\IDB.IO.Conversion.Converters\AsposeWordsConverter.cs:line 66
InnerException:

Hi Roald,


Thanks for your inquiry.

I tested your scenario with the latest version of Aspose.Words i.e. 13.3.0 and was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words from the following link:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

I hope, this helps.

Best regards,

Hi Awais,


Thank you for your quick reply. I have tested it with Aspose.Words 13.3.0 (and even hotfix 13.3.0.1) without success. The “Stack Empty” error occurs every time. Note that the problem only occurs when saving or rendering the document. I have created a unit test to test this scenario which uses the same file attached to this thread first post.

Just to be sure I also tested it on another machine (our buildserver) with the same result.

Please test with the code below.

[TestMethod]
public void Test_conversion_of_document_with_image_in_macrobutton()
{
Stream documentStream = new MemoryStream(WordResources.Document_with_image_in_macrobutton);
Document document = new Document(documentStream);
Stream output = new MemoryStream();
document.Save(output, SaveFormat.Pdf);
}

Kind regards,
Roald Lemmens
Hi Roald,

Thanks for the additional information.

While using the latest version of Aspose.Words i.e. 13.3.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The issue ID is WORDSNET-8121. Your request has also been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best regards,

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


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