abc PDF在IIS上生成一个空白页面

时间:2014-02-18 13:15:45

标签: asp.net abcpdf

我正在使用ABC PDF 8.0从HTML创建PDF,它在我的本地端运行良好,但在IIS上生成一个空白页面,我已经在IE级别,并提供文件夹的所有权限。当我尝试通过任何外部链接(如Google.com)生成PDF时,它可以完美地运行。我的链接上的更多内容是可访问的,页面上没有错误。请在下面找到代码供您参考。

var url="test.com"
 if (XSettings.InstallLicense(abcPDFkey))
            {

                using (Doc theDoc = new Doc())
                {
                    //apply a rotation transform
                    double w = theDoc.MediaBox.Width;
                    double h = theDoc.MediaBox.Height;
                    double l = theDoc.MediaBox.Left;
                    double b = theDoc.MediaBox.Bottom;
                    theDoc.Transform.Rotate(90, l, b);
                    theDoc.Transform.Translate(w, 0);
                   // To fix time out
                    theDoc.HtmlOptions.RetryCount = 1;
                    theDoc.HtmlOptions.Timeout = 25000;


                    // rotate our rectangle
                    theDoc.Rect.Width = h;
                    theDoc.Rect.Height = w;
                    theDoc.HtmlOptions.Engine = EngineType.Gecko;
                    theDoc.HtmlOptions.ImageQuality = 60;
                    int theID;
                    theID = theDoc.AddImageUrl(url);
                    while (true)
                    {
                        theDoc.FrameRect();
                        if (!theDoc.Chainable(theID))
                            break;
                        theDoc.Page = theDoc.AddPage();
                        theID = theDoc.AddImageToChain(theID);
                        int NewtheID = theDoc.GetInfoInt(theDoc.Root, "Pages");
                        theDoc.SetInfo(NewtheID, "/Rotate", "90");
                    }
                    for (int i = 1; i <= theDoc.PageCount; i++)
                    {
                        theDoc.PageNumber = i;
                        theDoc.Flatten();
                    }
                    foreach (IndirectObject io in theDoc.ObjectSoup)
                    {
                        if (io is PixMap)
                        {
                            PixMap pm = (PixMap)io;
                            pm.Realize(); // eliminate indexed color images
                            pm.Resize(pm.Width / 6, pm.Height / 6);
                        }
                    }
                       theDoc.Save(System.Web.HttpContext.Current.Server.MapPath("PDFFileName"));
                    theDoc.Clear();
                }

请帮忙,谢谢

1 个答案:

答案 0 :(得分:0)

好的,我弄清楚问题是什么。

首先,我定义了所有图像的相对路径,其次我们的服务器有内部IP,我定义了内部IP而不是公共域的URL。解决我的问题..

欢呼!!