How to use pdf.js with Meteor?

I am trying to get a helloworld example for working pdf.js in Meteor. So far I:

  • Hosted index.html, hello.js and pdf.js in the clients directory
  • Closed the contents of "hello.js" in the block "Meteor.startup ()"
  • Cut almost everything from index.html:

    <body>
        <canvas id="the-canvas" style="border:1px solid black;"/>
    </body>
    

I thought this was enough for this example to work, but Meteor ends the complaint about the declaration of โ€œ! DOCTYPE htmlโ€ in pdf.js, which is not in the file, so I assume that it is imported from somewhere.

It seems like I'm missing something obvious to get this to work, is there an easy solution for this?

(Also: I know about the pdf.js smart package, but since I am developing on Windows, this is not an option for me because I cannot get Meteorite. Although I believe that since the smart package already exists, it itโ€™s quite feasible for them to work together.)

+5
source share
2 answers

The meteor should not complain about the doctype declaration in js files. Is this the embedded version of pdf.js?

You can technically use atmosphere packages in your project by copying files as described in package.jsand smart.jsonto the repo, in this case at https://github.com/peerlibrary/meteor-pdf.js

Add coffeescript and underscore (in api.use)

meteor add coffeescript underscore

Then copy the files to the directory server: (as in api.add_files)

 bootstrap.coffee
 server.coffee

, , , , node, https://github.com/peerlibrary/meteor-pdf.js

0

Jquery getScript . .rendered( - , ):

$.getScript( "http://vivin.net/pub/pdfjs/pdf.js" );
$.getScript( "http://vivin.net/pub/pdfjs/textlayerbuilder.js" );

: http://api.jquery.com/jquery.getscript/

0

All Articles