rejetto forum

Software => HFS ~ HTTP File Server => Topic started by: jffortier on January 18, 2022, 09:52:43 PM

Title: Hosting and PDF viewing
Post by: jffortier on January 18, 2022, 09:52:43 PM
Hello people !

I use HFS to host JPG and PDF files, a (not so) recent change in ios13 made it impossible to view a PDF file inside a webviewer. Installed of showing the PDF, it will try to download it. The user is asked to download the file. It works, the file get downloaded.

I use Filemaker Go and it relies on the Safari engine in it webviewer. So now a simple URL http://www.myserver.com:80/folder1/folder2/file.pdf that was working before, no longer works. The URL in Safari will ask me to download, in Filemaker, the webviewer is not and I DON'T want the user to be able to download the file (contract archive).

Abode just releases a new API to view a PDF, it works perfectly. The only problem, it’s not working with HFS.

In my log, I see the request for the file, but it never gets download and I have an error in the API preview, can't view preview.

demo of the API https://www.adobe.io/document-services/apis/pdf-embed

Problem with HSF configuration ? The API that is not working with HFS ?

So that we're clear, the URL is not protected with a log in, if I enter this URL http://www.myserver.com:80/folder1/folder2/file.pdf in Chrome, the PDF file gets downloaded.

Thanks
Title: Re: Hosting and PDF viewing
Post by: rejetto on January 19, 2022, 08:13:49 AM
it doesn't like something in the hfs answer but it's hard to know what.
if you would know, it could be possible that you can modify hfs answer to comply.
you can try to file this as a big to adobe.
you may also make a test with hfs 3, but beware it's a very different program and you will start from zero
https://github.com/rejetto/hfs/releases
Title: Re: Hosting and PDF viewing
Post by: NaitLee on January 19, 2022, 09:05:47 AM
There's pdf.js (https://mozilla.github.io/pdf.js/getting_started/), and it's the pdf viewer built-in firefox. :)
You'll find relative helpful resources on the web, to include pdf.js into the served pages
Title: Re: Hosting and PDF viewing
Post by: jffortier on January 19, 2022, 02:41:14 PM
Thanks, but the new version is also not working  :(
Same, I can type the URL in chrome and the file gets downloaded as previous version.

So the problem must be from Adobe's side ::) and now try to get them to see that problem and fix it!! hoooo boy !!

As for NaitLee suggestion!  :o I will have a look but I'm no web developer, so I have no clue really how to incorporate stuff unless a complete example is published, most of the time they only show a small portion of code that you have to assemble to make it work

Thanks,
Title: Re: Hosting and PDF viewing
Post by: jffortier on January 19, 2022, 03:41:36 PM
I spoke with my web dev and he told me that the HFS server returns a "header : Content-Disposition : attachment"
and this force the download of the file, maybe that tel you something ??

I also notice that new HFS version, the config file, I changed the port from 80 to 8080, but when the program starts, the port display is still 80 and will respond to 80 when I call the server.
Title: Re: Hosting and PDF viewing
Post by: rejetto on January 19, 2022, 04:47:54 PM
ok you can disable the attachment thing:
Menu > other options > open directly in browser

the port problem with HFS 3 is that it's not clear that the # at the beginning is to disable the line, so your changes are actually ignored.
Remove it.
I will consider this thing for next release.
Title: Re: Hosting and PDF viewing
Post by: jffortier on January 19, 2022, 07:17:30 PM
BINGO !!

Well the Adobe is still not working, but after seeking thru the other options, I came out to the MIME settings, added *.PDF text/pdf and open in browser when MIME type is define, and now in my iOS device, the simple HTTP URL now open the PDF  ;D no need to have an HTML...

So I might have change the settings and thinking it was iOS13 that change something ??

But now it work like it was before.

Thank you,
Title: Re: Hosting and PDF viewing
Post by: jffortier on February 12, 2022, 05:22:14 PM
 :'(
Well it works on the iPad now, but when employees are using a laptop with Chrome, Edge... and open the link all we see is this... for a long long page of codes. With download or not the PDF, with the Acrobat extension or not, using Chrome default PDF viewer, all the same results  >:(

%PDF-1.2
5 0 obj
<<
/Type /XObject
/Subtype /Image
/Name /img0
/Width 1278
/Height 1576
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/Filter /DCTDecode
/Length 6 0 R
>>
stream
ÿØÿà�JFIF��–�–��ÿÛ�C�      

 $.' ",#(7),01444'9=82<.342ÿÛ�C          
Title: Re: Hosting and PDF viewing
Post by: rejetto on February 13, 2022, 03:48:56 PM
i guess it's because you apparently "invented" a mime type :D
mime types are conventions, so the only way is to google for it.
I did it for you, and apparently for pdf is application/pdf
hope it helps
Title: Re: Hosting and PDF viewing
Post by: jffortier on March 05, 2022, 10:13:18 PM
I forgot to reply  :o

Yes this was the case, change it from text/pdf to application/pdf and it work  ;D