I tried and get to know that the *"Content-Type=application/octet-stream"*
and *"Content-Disposition=attachment"* is the response sent by the server.

Because of which it always downloads. If I changed it to
*"Content-Type=application/pdf"* and remove
*"Content-Disposition=attachment"* and then send the response from the
server to the browser during handshake. Then it displays the PDF file in
the iframe.

It works in *Chrome, Mozilla  and IE browser*. It display the print preview
in the iframe   from which user can print to local printer which defines
the meaning of print command in the remote desktop. In my opinion
downloading the document isn't right as user want to print not to download
the document. If we are able to provide print preview wherever possible and
then fallback to download the documents then it would be good user
experience for users.

 IMPORTANT NOTE : I haven't  yet checked whether changing content-type
effects any other module .
 In Microsoft edge  it displays the PDF but after a long time ( after 2 min
).  Edge do have PDF viewer i.e. acrobat reader as default still it is
taking long time. I am still looking into it. ( It will display empty frame
as Mike said if user doesn't install any pdf reader on his/her machine in
the case of Edge and set default pdf reader as well)


Thanks and Regards,
Amarjeet Singh

On Tue, Nov 14, 2017 at 12:05 AM, Mike Jumper <[email protected]>
wrote:

> On Mon, Nov 13, 2017 at 9:56 AM, Amarjeet Singh <[email protected]>
> wrote:
>
>> Hi Team,
>>
>> when I print any file using guacamole redirected printer, it always
>> download the file instead of showing print preview.
>> It is written to follow the above behavior
>> .
>> I looked into guacamole common js where it downloads with the help of
>> iframe.
>>
>
> guacamole-common-js leaves the handling of downloads open to the
> implementor using the API. If you're looking at code which leverages an
> iframe for download, you are looking at the web application, not
> guacamole-common-js.
>
> I tried all the possible ways to edit the code and show the PDF files in
>> iframe instead of downloading directly.
>> It always downloads.
>> Then I tried to change the url and gave the url of the PDF file from the
>> server directly. It shows in the iframe and doesn't downloads.
>> I came to know that there is something with the url which always tried to
>> download.
>> Any suggestions to resolve and show the PDF file in the iframe?
>>
>
> My suggestion would be to not attempt to override this behavior, and allow
> the PDF to always download. Displaying the PDF within the browser is
> problematic, and does not work identically across all browsers. Some will
> display the PDF correctly, downloading the PDF only if no viewer is
> present, others will display an empty iframe/tab even though a PDF viewer
> is available or built-in, and yet others will silently fail with no way for
> JavaScript to detect this.
>
> Downloading the PDF directly is the only behavior which works universally.
>
> - Mike
>
>

Reply via email to