pdf.js wrapper for Yii Framework


Embedded pdf file in your web using pdf.js library.


Installing and configuring

  • Download and extract to extension folder.
  • Download latest pdf.js, and copy all files to pdfJs/assets folder. There are several libraries were modified for Yii Framework with prefix yii_* in assets/web/ include in this extension. Overwrite assets/web folder but make sure if yii_* files is not overwritten.


In your view



string $url : pdf file url
array $options : optional option to pdf.js viewer

Default options

    // Default sidebar state
    // ltr = left to right, rtl=right to left
    // Button visible state


Total 16 comments

#19135 report it
Simon Mathew at 2015/03/27 03:02am
Has anyone updated PDF.js

I tried updating but there is some issues can anyone help..?

#18443 report it
Fabio Schunig at 2014/10/29 05:23pm
Protected files

Hi! Is there a way of viewing protected files not accessible by URL?

For example: I have private PDF files in "protected/pdf" directory, and they must not be accessible by global internet users, only by logged users of my application. So, maybe could be a way of "internally read" the file by the Controller, and then pass it to the View _as a parameter for _qpdfjs show to the user.

Any thoughts?

#17545 report it
Lucky Vic at 2014/06/30 09:28pm

@newbiedo : i've uploaded working example. You can download and see how configure and use the extension. There is pdf.js library include in example application but the old version. I tried newest pdf.js library but not working well.

#17542 report it
newbiedo at 2014/06/30 10:48am
Where exactly do I put the files for pdf.js?

I have extracted the extension. I am not seeing the files you in assets/web that you mentioned.

#17541 report it
newbiedo at 2014/06/30 10:41am
Clarification on file placement for pdf.js

I have extracted the extension to the protected/extensions folder. I am confused about where to extract the pdf.js in my application.

#17026 report it
Vulkodava at 2014/04/25 08:18am
Extract images and performance issue

Hi, Cool extension.

I have couple questions, though, Can you help me understand why and how if possible I can prevent the browser lagging due to this plugin And can we extract the images in a particular PDF as files?


#16355 report it
Arnold Gultom at 2014/02/13 09:11pm
Thanks for the answer

Thank you very much Lucky Vic

#16346 report it
Lucky Vic at 2014/02/13 06:07am
download button

@arnold :

Add more options in your code.

#16344 report it
Arnold Gultom at 2014/02/12 11:42pm
No download button

Is there a download button to download the pdf file?

#14689 report it
Will Mendoza at 2013/09/03 02:34pm
thanks for upload demo files

@Lucky Vic thank you very much.

#14674 report it
Lucky Vic at 2013/09/03 12:01am
Update downloaded demo page

@trond: PDF file is only 993KB. Slow loading might due to your javascript.

@peter JK: If you are using firefox, there is no different. :)

@Will Mendoza: I've already upload demo page for this extension. Let me know if doesn't work with your app.

#14572 report it
Will Mendoza at 2013/08/23 01:55pm
Download demo page

Please, How to i can download the demo page?

#13835 report it
Peter JK at 2013/06/30 12:38pm
Nice Extension

Nice extension..

Just curious, what the main different between standard browser pdf viewer with this pdf.js?..

#13826 report it
trond at 2013/06/28 03:10pm
Slow loading

Loading the demo took about 30 seconds. I'm not sure that is because the PDF is very large or if there is another reason.

#13815 report it
Lucky Vic at 2013/06/27 11:42pm
demo page
#13814 report it
Nur Rochim at 2013/06/27 10:37pm

Please demo page

Leave a comment

Please to leave your comment.

Create extension