Using pdf.js to display pdf from raw data

后端 未结 2 1640
别跟我提以往
别跟我提以往 2021-02-13 01:57

I am just getting started with pdf.js and I am trying to load a pdf file from the raw pdf data. I have seen the code:

PDFJS.getPdf(\'cwpdf.pdf\', function getPdf         


        
2条回答
  •  长发绾君心
    2021-02-13 02:21

    Well, since no one else has answered I will post my findings. I figured out that yes, it is possible to load a pdf file from the raw data. The way this can be done is by using a UInt8Array populated with data in place of the url to where the pdf file is stored.

    Example code to do this is below:

    var int8View = new Uint8Array(...); //populate int8View with the raw pdf data
    PDFJS.getDocument(int8View).then(function(pdf) {
    
    }
    

提交回复
热议问题