We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Phalcon - Single Module Application and ViewerJS

Hi,

for an application (single module app with standard .htaccess-files like in the examples at the doc) I want to use ViewerJS to display PDF/ODT/...-Files.

The documentation of ViewerJS says:

<a href="/ViewerJS/#../path/to/filename.ext">

So, I do the following (like in the docs of ViewerJS):

<div class="embed-responsive embed-responsiv-4by3"> <iframe style="float:right;" src = "<?php echo $this->url->get('/public/js/ViewerJS/#../../files/entities/TOPs-2015-01-17.odt');?>" width='724' height='1024' allowfullscreen webkitallowfullscreen></iframe> </div>

The ViewerJS is stored in <app-root-dir>/public/js/ViewerJS. The files are stored in <app-root-dir>/public/files

I also tried different path's for the files after the #.

But in the iFrame it only shows my startpage. Maybe you can help me? How can I call the ViewerJS properly?

Thanks very much and a lot Aljoscha



98.9k
Accepted
answer

You need to use the URL component:

<?php echo $this->url->get("ViewerJS/#../path/to/filename.ext") ?>