read files pdf on browser

Asked

Viewed 25 times

-4

someone could help me with a problem, how can I get a link from a pdf file and open it in the browser itself using php note: the varialvel $file = 'article.pdf' comes from the database.

 <ul class="list-group mt-4">
                <?php
                    foreach ($this->Dados['sts_artigos_cientificos'] as $cientificos) {
                        extract($cientificos);
                    ?>
                        <li class="bg-secondary list-group-item d-flex 
                        justify-content-between align-items-center ">
                            <a class="text-white" href="<?php echo URL . '/assets/files/pdf/'
                            . $id . '/' . $arquivo; ?>" target="blank"><?php echo $titulo; ?></a>
                        </li>
                    <?php
                    }
                    ?>
</ul>

1 answer

-2

Do this by simply sending a file as a response to any URL. This is usually enough. There is a simple pdf viewer in any modern browser.

  • personal thanks I ended up solving changing the query where I bring the database information "$Listar->fullRead('SELECT id, title, file FROM sts_artigos_scientificos ORDER BY id DESC', 'LIMIT :limit','limit=10');"

Browser other questions tagged

You are not signed in. Login or sign up in order to post.