Feature ¶
Embedded pdf file in your web using pdf.js library.
Requirements ¶
- Yii Framework - Yii 1.1 or above
- pdf.js
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.
Usage ¶
In your view
$this->widget('ext.pdfJs.QPdfJs',array(
'url'=>$this->createUrl('/file/view',array('id'=>$model->id,'format'=>Files::PDF)),
Parameter ¶
string $url
: pdf file url
array $options
: optional option to pdf.js viewer
Default options ¶
$options=Array(
// Default sidebar state
'sideBarOpen'=>false,
// ltr = left to right, rtl=right to left
'direction'=>'ltr',
// Button visible state
'buttons'=>array(
'sidebarToggle'=>true,
'viewFind'=>true,
'pageUp'=>true,
'pageDown'=>true,
'zoomIn'=>true,
'zoomOut'=>true,
'scaleSelect'=>true,
'presentationMode'=>true,
'print'=>false,
'openFile'=>false,
'download'=>false,
'viewBookmark'=>false,
)
);
DEMO
Please demo page
demo page
try online demo
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.
Nice Extension
Nice extension..
Just curious, what the main different between standard browser pdf viewer with this pdf.js?..
Download demo page
Please, How to i can download the demo page?
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.
thanks for upload demo files
@Lucky Vic thank you very much.
No download button
Is there a download button to download the pdf file?
download button
@arnold :
Add more options in your code.
'buttons'=>array( 'download'=>true )
Thanks for the answer
Thank you very much Lucky Vic
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?
Thanks
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.
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.
Example
@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.
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?
Has anyone updated PDF.js
I tried updating but there is some issues can anyone help..?
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.