用于将PDF文件显示为flipbook的Javascript库?

时间:2016-06-21 11:32:04

标签: javascript pdf

我正在寻找一个将PDF文件显示为翻书的Javascript库,没有任何预处理
(我们已经存储了许多PDF文件并可通过下载访问,我们现在希望通过翻页以更加"用户友好" 的方式显示它们外观,但我们并不想将它们全部转换成翻书!...)

类似于:rendering the HTML page in browser > processing the input PDF bytes > displaying them as HTML5 flipbook...

您对此有何看法?

注意:希望它足够清楚......

1 个答案:

答案 0 :(得分:3)

我希望你的目标是this one

var flipBook;

jQuery(document).ready(function () {

    //easiest with default settings
    flipBook = $("#flipbookContainer").flipBook('example-assets/books/alice.pdf');

});

或者,您可以根据需要通过选项变量

自定义设置
var flipBook;

jQuery(document).ready(function () {

    //make sure this file is hosted in localhost or any other server
    var pdf = 'example-assets/books/alice.pdf';

    //these are extra settings
    var options = {
        webgl:false,
        height: 400,
        duration: 800,

        autoEnableOutline:true //auto open the outline/bookmarks tab
    };

    /**
     * outline is basically a array of json object as:
     * {title:"title to appear",dest:"url as string or page as number",items:[]}
     * items is the same process again array of json objects
     */
    options.outline = [
        {title: "Page 1", dest: 1},
        {title: "Page 2", dest:2},
        {title: "StackOverflow", dest: "https://stackoverflow.com/",items:[
            {title:"My Profile",dest :"https://stackoverflow.com/users/6687403/deepak-ghimire"},
            {title:"Page 3",dest:3}
        ]}
    ];


    flipBook = $("#flipbookContainer").flipBook(pdf, options);
});

希望它有所帮助。