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.

Mon Jul 21, 2014 6:03 pm

Hello folks,
I am evaluating Spire.Doc for the purpose of generating PDF files from Word templates in a Windows Azure environment. I am able to open the doc, manipulate content and save as Word2013 format but cannot save as PDF. The error out is pasted below.

Server Error in '/' Application.

Parameter is not valid.
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.ArgumentException: Parameter is not valid.

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:



[ArgumentException: Parameter is not valid.]
System.Drawing.Graphics.GetHdc() +1147361
sprᱥ.ᜀ(PageSetup A_0, ImageType A_1, MemoryStream A_2, Int32 A_3, GraphicsUnit A_4) +171
sprᱥ.ᜀ(PageSetup A_0, ImageType A_1, MemoryStream A_2, Int32 A_3) +19
sprᱥ.ᜒ() +182
sprᱥ.ᜁ(IDocument A_0) +224
sprᧆ.ᜀ(Document A_0) +93
Spire.Doc.Document.ᜂ(String A_0) +94
Spire.Doc.Document.SaveToFile(String fileName, FileFormat fileFormat) +255
LightWingMarketerPortal.Web.ScratchTest.Page_Load(Object sender, EventArgs e) in e:\DEV\LightWing\LightWingMarketerPortal\Production\LightWingMarketerPortal.Web\ScratchTest.aspx.cs:31
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
System.Web.UI.Control.OnLoad(EventArgs e) +92
System.Web.UI.Control.LoadRecursive() +54
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

shaunlandau
 
Posts: 10
Joined: Mon Jul 21, 2014 4:39 pm

Tue Jul 22, 2014 2:17 am

Hello,

Thanks for evaluting our product.
You will run into this error if you use Windows Azure WebSite because GDI is not well supported on Azure Shared WebSite. The only solution for this problem is to move to Azure Cloud Services or Virtual Machine.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Fri Jul 25, 2014 9:10 am

Hello,

Has the issue been resolved? Could you please give us some feedback if convenience?

If there are any questions, welcome to get it back to us.

Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Sat Nov 08, 2014 2:36 am

Yes, issue is resolved via use of cloud service to host the code.

shaunlandau
 
Posts: 10
Joined: Mon Jul 21, 2014 4:39 pm

Mon Nov 10, 2014 3:16 am

Hello,

Thanks for your feedback.
If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Sat Mar 19, 2016 5:27 am

Hi, would any Azure non-shared PaaS web hosting package do the trick, such as the "B1 Basic" in order not to get the error ?

Dan

daniel@xamika.com
 
Posts: 1
Joined: Fri Mar 18, 2016 3:46 pm

Mon Mar 21, 2016 2:18 am

Hi Dan,

Thanks for your posting.
Sorry that there is no Azure non-shared PaaS web hosting package do the trick at present.

Best Regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Mon Jul 03, 2017 5:54 am

We have procured license for Spire Doc Professional Edition to convert Word document to PDF. In developer machine it is perfectly working fine, whereas when we deployed the solution in Azure API App it is giving us Error as “Could not find the file path”. We have verified the path configured to save the generated PDF Document.

Please help us on this issue.

sundarpaul
 
Posts: 1
Joined: Mon Jul 03, 2017 5:50 am

Mon Jul 03, 2017 9:05 am

Hi sundarpaul,

I have received your word document. I got the following error on my Azure environment. It is a bug. Sorry for the inconvenience caused. I have forwarded it to our dev team. We will inform you once there is any good news.
error.png


Testing code:
Code: Select all
 protected void Button1_Click(object sender, EventArgs e)
        {
            WordToPdfConverter(Server.MapPath("~/Data/Test.docx"), Server.MapPath("~/Data/Test.pdf"));
        }
        public static void WordToPdfConverter(string wordDocumentpath, string pdfPath)
        {         
            Spire.Doc.Document doc = new Spire.Doc.Document();
            doc.LoadFromFile(wordDocumentpath);
            doc.SaveToFile(pdfPath, FileFormat.PDF);           
        }



Best wishes,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Thu Sep 28, 2017 9:41 am

Hi,

Thanks for patient waiting. Sorry for the delayed update.
The conversion of Word to PDF is workable in Azure now. Please use the following solution.
Code: Select all
Document doc = new Document();
  doc.LoadFromFile(filename);
  ToPdfParameterList tpl = new ToPdfParameterList
        {
            UsePSCoversion = true                         
        }; 
   doc.SaveToFile(resultname, tpl);


If you have any issues, please feel free to contact us.

Sincerely,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc