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.

Fri Dec 15, 2017 10:50 am

Hi Team,

Please help me out. I am using spire.doc 5.8 version is for download the word document. Its is getting download from my local machine. But in azure, am getting an error saying "A generic error occurred in GDI+.

Please tell me , does azure supports spire.doc 5.8 version. Also provide me the solution .

Regards,
Vanmathi N.A

vanmathi
 
Posts: 17
Joined: Tue Dec 17, 2013 4:40 am

Mon Dec 18, 2017 2:57 am

Hello,

Thanks for your inquiry.
Our Spire.Doc supports Azure, but I'm afraid the Version 5.8 may cause some problem since the feature related is fixed and improved in the recent release. Please download the use the Spire.Doc Pack(hot fix) Version:6.0.77. Besides, I would also like to know if you are converting the Word document to pdf file. If so, please refer to the below code.
Code: Select all
Spire.Doc.Document doc = new Spire.Doc.Document();
            doc.LoadFromFile(wordDocumentpath);
            ToPdfParameterList para = new ToPdfParameterList()
            {
                UsePSCoversion = true

            };
            doc.SaveToFile(pdfPath, para);

If there's still any issue, please get it back to us.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Dec 18, 2017 6:43 am

Thanks for the reply.

I am not doing any conversion here. I just want to download the word document. Also i Tried with that current version also. Even thought i am getting the same error. Could you please check the code and tell me where did wrong?

string filePath = "~Work/Template.docx";
LoadFromFile(HttpContext.Current.Server.MapPath(filePath));

DocumentSections.Add(new ScopeHeaderSection(this, DocumentTitle, DocumentAuthor));
DocumentSections.Add(new ScopeTableOfContentSection(this));

foreach (TemplateSectionLink templateSection in TemplateSectionLinks)
{
DocumentSections.Add(GetSectionType(templateSection));
}

foreach (ScopeDocumentSection section in this.DocumentSections)
{
section.WriteSection();
}

using (MemoryStream stream = new MemoryStream())
{
SaveToStream(stream, FileFormat.Docx);
Document finalDoc = new Document();
finalDoc.LoadFromStream(stream, FileFormat.Docx);
stream.SetLength(0);
finalDoc.UpdateTableOfContents();
finalDoc.SaveToStream(stream, FileFormat.Docx);
return stream.ToArray();
}

vanmathi
 
Posts: 17
Joined: Tue Dec 17, 2013 4:40 am

Mon Dec 18, 2017 7:18 am

Hello,

Thanks for your response.
To help us with a better investigation, could you please send your sample document to us(support@e-iceblue.com)?
Also, we need the following details:
1. The environment that your project runs on. eg. Server 2012 R2.
2. Where did the exception thrown and could you share the whole exception information?
3. Will you encounter the same issue if the process is in a local environment?

Looking forward to your reply.

Best Wishes.
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Dec 18, 2017 8:47 am

Hello Jane,
1. Exception details
Server Error in '/' Application.

A generic error occurred in GDI+.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[ExternalException (0x80004005): A generic error occurred in GDI+.]
System.Drawing.Imaging.Metafile..ctor(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type, String description) +227277
System.Drawing.Imaging.Metafile..ctor(Stream stream, IntPtr referenceHdc, RectangleF frameRect, MetafileFrameUnit frameUnit, EmfType type) +34
spr1093.0(PageSetup A_0, ImageType A_1, MemoryStream A_2, Int32 A_3, GraphicsUnit A_4) +258
spr1093.0(PageSetup A_0, ImageType A_1, MemoryStream A_2, Int32 A_3) +19
spr1093.19() +1023
spr1093.1(Document A_0) +143
Spire.Doc.Fields.TableOfContent.22() +133
Spire.Doc.Document.UpdateTableOfContents() +56
SGT.Infrastructure.Documents.ScopeOfWork.ScopeOfWorkDocument.WriteToDocument() in d:\a\1\s\SGT.Infrastructure\Documents\ScopeOfWork\ScopeOfWorkDocument.cs:112
SGT.Infrastructure.Documents.ScopeOfWork.ScopeOfWorkDocument.CreateDocument(Project project, Template template, Int32[] selectedTemplateSections, String userEmail) in d:\a\1\s\SGT.Infrastructure\Documents\ScopeOfWork\ScopeOfWorkDocument.cs:52
SGT.Web.Controllers.<CreateScope>d__5.MoveNext() in d:\a\1\s\SGT.Web\Controllers\ScopeOfWorkController.cs:54
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) +99
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +58
System.Web.Mvc.Async.TaskAsyncActionDescriptor.EndExecute(IAsyncResult asyncResult) +97
System.Web.Mvc.Async.<>c__DisplayClass37.<BeginInvokeAsynchronousActionMethod>b__36(IAsyncResult asyncResult) +17
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethod(IAsyncResult asyncResult) +32
System.Web.Mvc.Async.AsyncInvocationWithFilters.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3d() +50
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +228
System.Web.Mvc.Async.<>c__DisplayClass46.<InvokeActionMethodFilterAsynchronouslyRecursive>b__3f() +228
System.Web.Mvc.Async.<>c__DisplayClass33.<BeginInvokeActionMethodWithFilters>b__32(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeActionMethodWithFilters(IAsyncResult asyncResult) +34
System.Web.Mvc.Async.<>c__DisplayClass2b.<BeginInvokeAction>b__1c() +26
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__1e(IAsyncResult asyncResult) +100
System.Web.Mvc.Async.WrappedAsyncResult`1.CallEndDelegate(IAsyncResult asyncResult) +10
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Async.AsyncControllerActionInvoker.EndInvokeAction(IAsyncResult asyncResult) +27
System.Web.Mvc.Controller.<BeginExecuteCore>b__1d(IAsyncResult asyncResult, ExecuteCoreState innerState) +13
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecuteCore(IAsyncResult asyncResult) +36
System.Web.Mvc.Controller.<BeginExecute>b__15(IAsyncResult asyncResult, Controller controller) +12
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +22
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) +26
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.EndExecute(IAsyncResult asyncResult) +10
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__5(IAsyncResult asyncResult, ProcessRequestState innerState) +21
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) +29
System.Web.Mvc.Async.WrappedAsyncResultBase`1.End() +49
System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +28
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
System.Web.CallHandlerExecutionStep.OnAsyncHandlerCompletion(IAsyncResult ar) +129

2. sample document details:

it is empty document which has only header and footer.

3. yes, it is working fine in local environment.

4. environment is also Server 2012 R2
Please help me

vanmathi
 
Posts: 17
Joined: Tue Dec 17, 2013 4:40 am

Mon Dec 18, 2017 9:18 am

Hello vanmathi,

Thanks for your details.
Since every document has its own data and structure, your sample document may help a lot in the process of our investigation. Could you please send it to us?

Sincerely,
jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Dec 18, 2017 10:24 am

Hello Jane,

I have attached the sample document.

Regards,
vanmathi N.A

vanmathi
 
Posts: 17
Joined: Tue Dec 17, 2013 4:40 am

Tue Dec 19, 2017 10:09 am

Hello vanmathi N.A,

Thanks for your document.
I will look into it and reply you ASAP.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue Dec 19, 2017 1:27 pm

Thanks Jane.

Awaiting for your reply.

Regards,
Vanmathi N.A

vanmathi
 
Posts: 17
Joined: Tue Dec 17, 2013 4:40 am

Thu Dec 21, 2017 10:17 am

Hello,

After a thorough test, we didn't reproduce the issue you mentioned.
According to the exception details, we would like to know if you have added any content including any pictures into your template? Could you please share the document after adding the contents?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Thu Dec 28, 2017 11:01 am

Hi Jane,

We are not including any pictures and all. it will just add the some paragraph of content only. still issue is not resolved. So I cannot send you the content . We can see the included content after downloading only.

You are saying, that attached document is working fine at your end right?? Can you able to download that document with the same code what I written?

vanmathi
 
Posts: 17
Joined: Tue Dec 17, 2013 4:40 am

Fri Dec 29, 2017 10:34 am

Hello vanmathi,

Thanks for your reply.
Yes, It is very strange, I tested the template file you sent to me on Server 2012 r2 and it worked well. I just added some paragraphs and save to memory. Attached is the result file downloaded from azure.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.Doc