使用福昕SDK如何实现平铺文本水印?

V9.1及以上版本的Foxit PDF SDK已提供添加平铺水印接口:foxit::pdf::PDFDoc::StartAddTiledWatermark()

JAVA语言示例代码如下:

    public static void addTiledWatermark() throws PDFException {
        PDFDoc doc=new PDFDoc("D:\\test\\AboutFoxit.pdf");
        doc.load(null);
        TiledWatermarkSettings watermarkSettings=new TiledWatermarkSettings(1.5f,1.5f,30,50,2,TiledWatermarkSettings.e_FlagAsAnnot);
        WatermarkTextProperties textProperties=new WatermarkTextProperties(new Font("Simsun", e_StylesSmallCap, e_CharsetGB2312, 0),20,0x00ff00,0,0,0);

        Progressive progressive=  doc.startAddTiledWatermark("Foxit PDF SDK\nwww.foxitsoftware.com",watermarkSettings,textProperties,new Range(0,doc.getPageCount()-1,Range.e_All),null);
        if (progressive.getRateOfProgress() != 100)
        {
            int state = Progressive.e_ToBeContinued;
            while (Progressive.e_ToBeContinued == state)
            {
                state = progressive.resume();
            }
        }
        doc.saveAs("D:\\test\\addTiledWatermark.pdf",0);
    }

效果呈现如下: