Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Jul 15, 2015 8:57 am

Dear Spire,

I am currently using spire.pdf free version. I facing problem whereby my local able to export the pdf and when i put my solution in the server it still export but the chart fail to draw into the PDF. Is there any solution to this? need it urgently. Thanks

Code: Select all
 protected void btnExportChart_Click(object sender, EventArgs e)
        {
            try
            {
                 //create a pdf document.
                PdfDocument doc = new PdfDocument();
                PdfPageSettings setting = new PdfPageSettings();
                setting.Margins.Top = 15F;
               
                String url = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority +
                System.Web.HttpRuntime.AppDomainAppVirtualPath +"/KRI/ReportExport/frmKRI_ChartExport.aspx?levelid=" + hdchkvalue.Value + "&freqtype=" + FrequencyType + "&userid=" + GlobalSetting.UserID + "";

                Thread thread = new Thread(() =>
                { doc.LoadFromHTML(url, false, true, true, setting); });
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                thread.Join();
             
                doc.SaveToHttpResponse("KRIChart.pdf", Response, HttpReadType.Save);

                doc.Close();
            }
            catch (Exception ex)
            {
                Framework.Error.AppError.BoxErrorTech(this.Page, ex);
            }
        }


tralex
 
Posts: 5
Joined: Mon Mar 02, 2015 7:31 am

Wed Jul 15, 2015 9:56 am

Dear tralex,

There is a new method to convert html to pdf, please have a try:
http://www.e-iceblue.com/Tutorials/Spir ... lugin.html

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Wed Jul 15, 2015 10:06 am

Dear Betsy,

Ok i give it a try. Thanks

tralex
 
Posts: 5
Joined: Mon Mar 02, 2015 7:31 am

Wed Jul 15, 2015 10:59 am

hmm.... not sure why i put in the same folder it still couldn't find the HTMLConvert dll. Please Advice Thanks.

Code: Select all

using Spire.Pdf;
using Spire.Pdf.Graphics;
using Spire.Pdf.HtmlConverter.Qt;

protected void btnExportChart_Click(object sender, EventArgs e)
{
            try
            {

                String url = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority +
                System.Web.HttpRuntime.AppDomainAppVirtualPath +"/KRI/ReportExport/frmKRI_ChartExport.aspx?levelid=" + hdchkvalue.Value + "&freqtype=" + FrequencyType + "&userid=" + GlobalSetting.UserID + "";

                Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(url, "HTMLtoPDF.pdf",true,100 * 1000,new SizeF(612, 792),new PdfMargins(0, 0));

                System.Diagnostics.Process.Start("HTMLtoPDF.pdf");

            }
            catch (Exception ex)
            {
                Framework.Error.AppError.BoxErrorTech(this.Page, ex);
            }
 }


tralex
 
Posts: 5
Joined: Mon Mar 02, 2015 7:31 am

Thu Jul 16, 2015 8:48 am

Dear tralex,

Thanks for your response. I suggest you use below way to set your plugin path:
Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = " ";
And when you put your solution in server, I suggest you set "Enable 32-Bit Applications" to "true" in your IIS Application Pools Settings to see if the chart is lost.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Mon Jul 20, 2015 3:14 am

Dear Betsy,

I have try all your suggestion it still doesn't work.

Code: Select all
 
protected void btnExportChart_Click(object sender, EventArgs e)
 {
       try
           {

                String url = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority +
                System.Web.HttpRuntime.AppDomainAppVirtualPath +"/KRI/ReportExport/frmKRI_ChartExport.aspx?levelid=" + hdchkvalue.Value + "&freqtype=" + FrequencyType + "&userid=" + GlobalSetting.UserID + "";

                Spire.Pdf.HtmlConverter.Qt.HtmlConverter.PluginPath = System.Web.HttpContext.Current.Request.Url.Scheme + "://" + System.Web.HttpContext.Current.Request.Url.Authority +
                System.Web.HttpRuntime.AppDomainAppVirtualPath + "/WebProject/bin/Spire.Pdf.dll";

                Spire.Pdf.HtmlConverter.Qt.HtmlConverter.Convert(url, "HTMLtoPDF.pdf", true, 100 * 1000, new SizeF(612, 792), new PdfMargins(0, 0));

                System.Diagnostics.Process.Start("HTMLtoPDF.pdf");

          }
          catch (Exception ex)
          {
                Framework.Error.AppError.BoxErrorTech(this.Page, ex);
          }
}

tralex
 
Posts: 5
Joined: Mon Mar 02, 2015 7:31 am

Mon Jul 20, 2015 9:29 am

Dear tralex,

Thanks for your feedback.
Sorry that I didn’t reproduce your issue. There is a live demo, please download it and see how it is going:
http://www.e-iceblue.com/downloads/temp/5402webtest.zip

Best wishes,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Wed Jul 22, 2015 6:33 am

Dear tralex,

Have you tried the demo ? Does it work ? Has your issue been resolved ?

Best Regards,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Fri Jul 24, 2015 8:50 am

Hey,

Sorry For the late response. I have workaround the problem and fixed the issue.


Thanks For Your Kind Support.

tralex
 
Posts: 5
Joined: Mon Mar 02, 2015 7:31 am

Fri Jul 24, 2015 8:54 am

Dear tralex,

Thanks for your response.
Please feel free to contact us if you have any questions or needs.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy
 
Posts: 802
Joined: Mon Jan 19, 2015 6:14 am

Return to Spire.PDF