open a pdf file in the folder public

Hello, I you make reports in pdf using a library that created the file, and then opened in the browser with the following code

echo "<script language='javascript'>window.open('listageneralusuarios.pdf','_self','');</script>";//para ver el archivo pdf generado

But the file is created in the public folder and have the following error message

Action 'listageneralusuarios.pdf' was not found on handler 'spt_encabezado'

How do I open the PDF file in the browser?



34.6k

Hello

First you need go to the url http://youwebsite/istageneralusuarios.pdf, is have exist and then edit your code

window.open('listageneralusuarios.pdf','_self','')

Tobe

window.open('/listageneralusuarios.pdf','_self','')


31.4k

If there was created in the public folder

Hello

First you need go to the url http://youwebsite/istageneralusuarios.pdf, is have exist and then edit your code

```php window.open('listageneralusuarios.pdf','_self','') ```

Tobe

```php window.open('/listageneralusuarios.pdf','_self','') ```