【问题标题】:abcpdf content front of header and footer [closed]abcpdf 内容前面的页眉和页脚 [关闭]
【发布时间】:2015-03-03 06:23:48
【问题描述】:

我正在尝试使用 abcpdf 创建一个结构,假设如下:

标题 内容 页脚

P.S:内容需要在页眉和页脚的“前面”

换句话说,我需要让我的内容从 y = 0 到 y = 100%;我的标题从 y = 0 到 y = 200;我的页脚从 y = 700 到 y = 100%(此处的值只是示例)

我希望我是清楚的。

目前我有这些方法:

private void CreateDocHeader(Doc theDoc, int theCount, string content)
    {
        theDoc.Rect.String = "0 660 600 825";
        theDoc.MediaBox.String = theDoc.Rect.String;
        for (int i = 1; i <= theCount; i++)
        {
            theDoc.PageNumber = i;
            theDoc.AddImageHtml(content);
        }
    }

    private void CreateDocFooter(Doc theDoc, int theCount, string content)
    {
        theDoc.Rect.String = "0 200 600 10";
        theDoc.MediaBox.String = theDoc.Rect.String;
        for (int i = 1; i <= theCount; i++)
        {
            theDoc.PageNumber = i;
            theDoc.AddImageHtml(content);
        }
    }

    private void CreateDocContent(Doc theDoc, int theID, string theContent, ref int theCount)
    {
        theDoc.Rect.String = "0 800 600 10";
        theDoc.MediaBox.String = theDoc.Rect.String;
        theID = theDoc.AddImageHtml(theContent);
        while (theDoc.Chainable(theID))
        {
            theDoc.Page = theDoc.AddPage();
            theID = theDoc.AddImageToChain(theID);
        }
        theCount = theDoc.PageCount;
    }

有人吗?

【问题讨论】:

    标签: c# header footer abcpdf


    【解决方案1】:

    使用 Hpos 和 Vpos 属性来做到这一点:-

    对于标题,请执行以下操作:

    theDoc.HPos = 0.5;
    theDoc.VPos = 1.0;
    

    这将使您的标题保持左对齐。

    对于页脚,这样做:

    theDoc.HPos = 1.0;
    theDoc.VPos = 0.5;
    

    这将使您的页脚保持正确对齐。

    希望这会有所帮助。

    加法:

    要获得 Z 位置,即页眉/页脚和内容具有不同的层,请使用 Layer 属性。这个属性加上LayerCount属性,你就可以有解决方案了。

    有关更多参考,请参阅此文档:-

    http://www.websupergoo.com/helppdfnet/source/5-abcpdf/doc/2-properties/layer.htm http://www.websupergoo.com/helppdfnet/source/5-abcpdf/doc/2-properties/layercount.htm

    【讨论】:

    • 我知道了,但你知道如何设置“Z”位置吗?要将页眉作为第 0 层,将页脚作为第 0 层,将内容作为第 1 层?感谢您的回复!
    猜你喜欢
    • 1970-01-01
    • 2023-03-17
    • 1970-01-01
    • 1970-01-01
    • 2022-01-15
    • 1970-01-01
    • 2012-07-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多