This topic is locked

View as pdf

2/26/2021 8:30:01 AM
PHPRunner General questions
S
SVblue author

Hello,
I'm trying to show an uploaded pdf-file within the browser:
My field called "document";

"Edit as": File; Allowed file types: pdf

"View as": PDF
I upload a pdf-file but after this, in the browser I see only:
%PDF-1.7 %�쏢 5 0 obj <> stream x��[�r�-o�W����E�~x�8R�JDK�ʂ�B))>���H�6�40�g��$e^UE,I3�ƣ��>�������?�������p�a��ó�����ͻ�g�I���j���A�p�z�YA ���`��N��j�ƓB��@�(os'׃S*�Wk<>���1��;Ŭ4��2�?߼������q�d��t
I tried several browser (Edge, Firefox, Chrome).
The phprunner help says:

"The View as PDF option works similarly to View as File, but it allows you to view uploaded PDF files directly in the browser."

I think the upload works fine... I can open the pdf from the MariaDB directly (e.g. with phpmyadmin).
Is there some way to get it work?
PS: I'm using phprunner 10.5 enterprise - maybe this information is usefull.

fhumanes 2/26/2021

Hello.
I think you are not saving the file name in any field in the database (this can be done if you define a field for this purpose).
When you show the content of the file, since PHPRunner does not know how to give it the name, it does not give it the extension of "pdf" and the browser tries to show it as a "txt" file.
Try defining the field and saving the file name.
Greetings,

fernando

S
SVblue author 2/26/2021

Thank you for reply,
the filename is stored in the database (varchar field) correctly.
At "View as": PDF you can't reference to this field "filename".

The document it self is stored binary (*.bin) ... when downloading this, rename/change bin to pdf ... you can see the document as it is.

But, how to view it within the list/view?

Sergey Kornilov admin 3/2/2021

'View as' PDF is designed to work with files stored on the hard drive while you store those files right in the database. Choose another varchar field as 'Edit as' File, upload some PDF and 'View as' PDF will work.