Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Apr 18, 2017 2:24 pm

I'm encountering a new issue when saving a Word document as a PDF:

For this one file, the Document successfully loads (LoadFromFile) but when the SaveToFile method is called (for FileFormat.PDF), the application just hangs. Running my hosting application in debug mode, I see the method called, but it never returns. Eventually the application will throw a stack overflow exception.

If I call SaveToFile with FileFormat.Txt, there are no issues, so this seems specific to the PDF conversion.

I'm uploading the file that is causing the problem. I'm not sure how this file differs from the others we've successfully converted, but it is coming from a different source.

Thanks,
Kevin Lukes
Programmer/Analyst

klukes
 
Posts: 17
Joined: Thu Mar 02, 2017 4:59 pm

Wed Apr 19, 2017 6:01 am

Dear Kevin,

Thanks for your feedback.
I have tested the file with Spire.Doc Pack(hot fix) Version:5.8.76. It can be converted to PDF successfully, and I have attached my result file for checking. Please try to use this version. If the hanging/exception issue still happens, please provide us with the OS information (e.g. Win7 64bit) and Region/Language (e.g. China/Chinese).
In addition, I found the border of table in result PDF had a little issue, and posted it to our Dev team. Once there is any progress, we will inform you.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Apr 19, 2017 4:23 pm

I'm afraid the problem persists, even with the latest hotfix.

In my test environment, I'm running from a Windows 10 Enterprise (10.0.10586 Build 10586) 64-Bit desktop. The locale is United States and language is English (United States).

The hosting application is compiled as a 32-bit application using Visual Studio 2015 Enterprise (Update 3) and the Microsoft .NET Framework 4.6.1 (I tried backing it down to 4.5 but it didn't make any difference).

This is the code snippet that is causing the problem:

Code: Select all
Document doc = new Document();
doc.LoadFromFile(source);
doc.ClearMacros();
doc.SaveToFile(destination, FileFormat.PDF);


Both source and destination are local file paths for the purpose of testing. In debug mode, stepping through the first 3 lines is fine, stepping into the last line results in the hang.

Kevin Lukes
Programmer/Analyst

klukes
 
Posts: 17
Joined: Thu Mar 02, 2017 4:59 pm

Wed Apr 19, 2017 5:29 pm

Just a further follow up...

If I remove the table formatting (i.e. select the table and "Convert to Text"), then Spire.Doc has no problem with the PDF conversion.

I don't know what is different about the table in this document, but I created my own test document with a table that spanned 12 pages (in the original document, the table spanned 11 pages) and it converted just fine.

Kevin Lukes
Programmer/Analyst

klukes
 
Posts: 17
Joined: Thu Mar 02, 2017 4:59 pm

Thu Apr 20, 2017 6:32 am

Dear Kevin,

Many thanks for the information.
Sorry that I still cannot reproduce the issue on the envirement you mentioned.
Could you please provide us with a sample project so that we can run it directly on our side ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Apr 20, 2017 9:12 pm

I've encountered an interesting situation...

I prepared a sample desktop solution, and in the course of testing it I was very annoyed to discover that the conversion worked this time. However, when I checked the resulting PDF I found it had the Evaluation Warning in the header (similar to the result you had sent me). I had added my license file to the project but I had forgotten to set it as an embedded resource. I did that and then re-ran my test. This time it hung the same way as before, so there appears to be a difference in behavior between an evaluation run and a licensed run (as well as something peculiar about this particular document).

I'm attaching the sample project for you to review.

Also, in the course of the second debug run, after about a minute waiting for the call to finish, the application went into break mode with the following message (this may have to do more with being in the debug environment, so I don't know how helpful it will be):

Managed Debugging Assistant 'ContextSwitchDeadlock' has detected a problem in 'C:\Users\klukes\Documents\Visual Studio 2015\Projects\SampleTest\SampleTest\bin\Debug\SampleTest.vshost.exe'.

Additional information: The CLR has been unable to transition from COM context 0x17c6048 to COM context 0x17c6100 for 60 seconds. The thread that owns the destination context/apartment is most likely either doing a non pumping wait or processing a very long running operation without pumping Windows messages. This situation generally has a negative performance impact and may even lead to the application becoming non responsive or memory usage accumulating continually over time. To avoid this problem, all single threaded apartment (STA) threads should use pumping wait primitives (such as CoWaitForMultipleHandles) and routinely pump messages during long running operations.


Thanks,
Kevin Lukes
Programmer/Analyst

klukes
 
Posts: 17
Joined: Thu Mar 02, 2017 4:59 pm

Fri Apr 21, 2017 3:56 am

Dear Kevin,

Many thanks for your detailed information.
I have reproduced the issue and posted it to our Dev team. Once there is any progress, we will inform you immediately.
So sorry for the inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed May 03, 2017 7:25 am

Dear Kevin,

Thanks for your waiting.
Now the hanging issue has been fixed in Spire.Doc Pack(hot fix) Version:5.9.3, welcome to test it.
But sorry that the table border issue is not resolved, once it is fixed, we will inform you.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu May 04, 2017 1:22 pm

Hi Betsy,

Great - we've run the new component through our internal and in-place testing and it works fine now.

Thanks again for all your help.

Kevin Lukes
Programmer/Analyst

klukes
 
Posts: 17
Joined: Thu Mar 02, 2017 4:59 pm

Return to Spire.Doc