Loading...
 

ViewerJS

As of Tiki 15.0 (also backported to 14.2 and 12.5 ) support has been added for ViewerJS.

ViewerJS can already natively show both PDF files and many types of Office files stored in OpenDocument Format, the open standard for office documents. ODF is available by default in almost any modern office applications such as Microsoft Office, LibreOffice, Apache OpenOffice and Calligra Suite. Because it is built on modern web technologies, ViewerJS understands embedded fonts, so your documents look pretty everywhere.

Install

Assuming:

  • Site address is http://tiki15.docker
  • Document root path is /var/www/html
  • Database name is tiki15
  • For this example we will use PluginMediaPlayer.


Getting and unpacking viewerjs

1. Get viewerjs

Copy to clipboard
curl -o /tmp/viewejs.zip \ https://viewerjs.org/releases/ViewerJS-latest.zip


2. Unzip content on Tiki installation

Copy to clipboard
unzip /tmp/viewejs.zip \ -d /var/www/html/files


3. Fix folder name

Copy to clipboard
mv /var/www/html/files/viewerjs-0.5.8 \ /var/www/html/files/viewerjs


4. Remove uneeded zip file

Copy to clipboard
rm /tmp/viewejs.zip


Setting up Tiki

Remembering, for this example we will use PluginMediaPlayer.

Activate ViewerJS


1. Go to "File Galleries" admin page (http://tiki15.docker/tiki-admin.php?page=fgal)
2. Click on "Enhancements" Tab
3. On "Access" section check the option "Use Viewer JS"
4. Click on "Apply" button



1. Load credentials

Copy to clipboard
eval $(sed -n '/
\$/s/
\$//p' /var/www/html/db/local.php)


2. Setup new preferences

Copy to clipboard
mysql -u$user_tiki -p$pass_tiki -h$host_tiki $dbs_tiki << EOF INSERT INTO tiki_preferences VALUES ('fgal_viewerjs_feature', 'y') ON DUPLICATE KEY UPDATE value='y'; INSERT INTO tiki_preferences VALUES ('fgal_viewerjs_uri', 'files/viewerjs/ViewerJS/index.html') ON DUPLICATE KEY UPDATE value='files/viewerjs/ViewerJS/index.html'; EOF



Adjust Editor toolbar

1. Go to toolbar edit page (http://tiki15.docker/tiki-admin_toolbars.php)
2. On section "Plugin Tools" locate and drag "mediaplayer" to section "Row 1"
3. Click on "Save" button

Usage

You can use ViewerJS through the File Gallery, or through PluginMediaplayer or through PluginIframe, but remembering, for this example we will use PluginMediaPlayer.

1. Go to File Galleries upload page (http://tiki15.docker/tiki-upload_file.php)
2. Select any PDF you want
3. Click on "Upload" button
4. Write down the file ID (Let's suppose ID is 1)
5. Edit any page you want (eg.: http://tiki15.docker/tiki-editpage.php?page=HomePage)
6. On editor toolbar, click on button with "Play" icon
7. On "URL" field, type "tiki-download_file.php?fileId=1", where 1 is the file ID
8. On "File type" field, type "PDF"
9. Click on "Insert" button
10. After popup closes, click on "Save" button

You should see the PDF inside your page.

Related

Related:


Collection of References on doc.tiki.org

  • Print general info about printing
  • PDF general overview about PDF creation in Tiki
  • mPDF create PDFs from Tiki content (advanced library that works even on shared hosting). Recommended for Tiki18+
  • PluginPDF alter default settings of mPDF per wiki page
  • PluginPDFPageBreak add a page break for PDFs created with mPDF
  • PluginMediaPlayer display PDF file from file gallery
  • PDF.js viewer PDF.js from Mozilla
  • ViewerJS: a script to view PDFs and ODFs, which bundles WebODF
  • PluginArchiveBuilder Generate a zip file, including PDFs from wiki pages
  • WeasyPrint A PDF generation option in Python
  • wkhtmltopdf create PDFs from Tiki content (needs root installation)
  • dompdf once used for PDF print of slideshows

List Slides