Printing 打印pdf时使用薄边框

Printing 打印pdf时使用薄边框,printing,abcpdf,Printing,Abcpdf,我们使用ABCPDF的8.1版从html生成一些漂亮的PDF文档 现在我们发现,在AdobeReader中打印会在页面的顶部和底部添加一些薄边框,这些边框在显示文档时不可见。同样,当打印到XPS时,这些线条不可见 我想我们一定错过了一些避免这种情况的设置 目前,我们打印的页面如下: using (var doc = new WebSupergoo.ABCpdf8.Doc()) { doc.HtmlOptions.DoMarkup = fal

我们使用ABCPDF的8.1版从html生成一些漂亮的PDF文档

现在我们发现,在AdobeReader中打印会在页面的顶部和底部添加一些薄边框,这些边框在显示文档时不可见。同样,当打印到XPS时,这些线条不可见

我想我们一定错过了一些避免这种情况的设置

目前,我们打印的页面如下:

        using (var doc = new WebSupergoo.ABCpdf8.Doc())
        {
            doc.HtmlOptions.DoMarkup = false;
            doc.HtmlOptions.AddLinks = false;
            doc.HtmlOptions.FontEmbed = true;
            doc.HtmlOptions.Engine = EngineType.Gecko;

            //in case that we need to create more than 1 page, we need go get the PageId and use it
            int pdfPageId = doc.AddImageHtml(html);
            while (true)
            {
                doc.FrameRect();
                if (!doc.Chainable(pdfPageId))
                    break;
                doc.Page = doc.AddPage();
                pdfPageId = doc.AddImageToChain(pdfPageId);
            }

            for (int i = 1; i <= doc.PageCount; i++)
            {
                doc.PageNumber = i;
                doc.Flatten();
            }

            doc.Save(pathToSave);
        }
结果:线条变得更粗,甚至可以在AdobeReader和Foxit Reader打印之前看到。这还不是解决办法

更新2:

我还需要设置文档的Rect:

            //set the printed area to A4
            doc.Rect.String ="A4";
            doc.MediaBox.String = "A4";

结果:现在在侧面绘制线条,只有在打印时才能看到。这还不是完整的解决方案。

好吧,从网络上复制粘贴代码是有危险的

此行在内容周围添加框架:

    doc.FrameRect();
我所要做的就是把它拿走。。并且不再显示更多的行

直到现在我才完全忽略了这一点

在此之前,我还尝试了以下方法,但没有达到预期效果:

    //set the width to 0, so Rectancles have no width
    doc.Width = 0;
    // set the color to white, so borders of Rectangles should not be black
    doc.Color.String = "255 255 255"; //Edited based on the comments.
    //set the width to 0, so Rectancles have no width
    doc.Width = 0;
    // set the color to white, so borders of Rectangles should not be black
    doc.Color.String = "255 255 255"; //Edited based on the comments.