分享

抓取OSCHINA标签生成文字云PDF

 看见就非常 2014-11-28
XDOC能从HTML中获取数据,重新展示
标签: <无>

代码片段(2) [全屏查看所有代码]

1. [代码][JavaScript]代码     跳至 [1] [全屏预览]

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<script type="text/javascript" src="http://xdoc.sinaapp.com/xdoc.js"></script>
<script type="text/javascript">
var xdoc = {
    "paper" : {
        "margin": "24"
    },
    "back": {
        "fillImg": "#@f40"
    },
    "body": {
        "sizeType": "autosize",
        "items": [
            {
                "Class": "para",
                "items": [
                    {
                        "Class": "chart",
                        "width": "600",
                        "height": "400",
                        "type": "word",
                        "fontName": "",
                        "href": "{3}",
                        "sql": "select ${a/text()} tag,"
                             + "       trim(replace(${span/text()},\'x\')) active,"
                             + "       ${a/@href} href"
                             + "  from ${xpath(body/div[3]/div[1]/div[2]/ul/li)}"
                    }
                ]
            }
        ]
    }
};
XDoc.run(xdoc, "pdf", {"_xdata":"http://www.oschina.net/question/tags"});
</script>

2. [图片] Snap1.png    

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多