Streaming PDF to browser, not working in mobile device - java

OK, so... I didnt notice the problem at first, i could stream my pdf as a byte[] directly to my browser and everything worked fine.
I realized the problem when I was going to try it in the browsers debug section -> under "toggle device mode", suddenly the pdf cannot be streamed to the
browser anymore(atleast, it cannot be displayed). Here's some of my code:
The PDF output (view_mypdf):
req.getResponse().setContentType("application/pdf");
req.getResponse().getOutputStream().write(delegate.getPdfBytes(), 0, delegate.getPdfBytes().length);
req.getResponse().getOutputStream().flush();
req.getResponse().getOutputStream().close();
My JSP with the iframe..
<iframe src="myurl/Controller?view_mypdf" style="height:300px; width: 300px;" name="iframeId" id="iframeId"></iframe>
I am not using any special CSS or JavaScript to do this, maybe i should? anyone has an idea why this doesn't work on a mobile device(google chrome) if it actually works on desktop in chrome?

Related

Webview can't render Virtual DOM and shows blank in SPA using Vue-CLI

I'm a web developer and don't know android programming.
my problem showed itself when I decided to lunch my single page app that created by vue cli 4 for mobile devices
actually I used this repository for build a webview for it:
https://github.com/slymax/webview
but I don't know that why does it show blank page? (I just know my webview can render DOM but can't render virtual DOM of my application.
because I tried to run my app with any browser and it worked but in webview I couldn't see my results)
any way...
where is my problem? If you need to check some config files like vue.config.js or something like that in my vue cli directory, please tell me.
I founded my problem! It's about my plugins in vue-cli like vue-hammerjs
It's not support webview platforms and after disable all of them in main.js, everything was going right.

Webview loads url and then this image

I am trying to open in Webview webpages in same quality as it apears in normal browser. It is ok in most cases, but found one "special" url. Urls loads ok, but then after like 2 secons whole pageview is white with picture of play icon in circle. I can not click on it, just nothing. If I open this website in chrome and other browsers everything is just fine. Im not sure if it is not some kind of javascript, but JS is allowed in Webview.
Website is : https://www.auto.cz/volkswagen-polo-gti-zmena-jako-remen-87481
Image that appears is: https://ibb.co/yh7XPpJ
I have tried a lot of Webview settings but nothing helps. I thing it is causing small javascript ad which will pops-up in bottomside of page when url is opened in phone.
WebSettings wsett = webviewVariable.getSettings();
wsett.setJavaScriptEnabled(true);
wsett.setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
wsett.setDomStorageEnabled(true);
wsett.setDatabaseEnabled(true);
wsett.setMinimumFontSize(1);
wsett.setMinimumLogicalFontSize(1);
wsett.setBuiltInZoomControls(true);
wsett.setDisplayZoomControls(false);
wsett.setAppCacheEnabled(true);
webviewVariable.loadUrl(url);
I would like to know what settings is missing.

mp4 files dont work properly on chrome

I have 10 MP4 files which I am embedding in my application. When I open my application in Edge, i am able to play all the 10 files smoothly, but in chrome, they don't work properly. I have to refresh the browser couple of time, to make them work.
Though, they work fine if I open the MP4 link directly on chrome.Any idea why they don't work properly on chrome. I am using Vaadin to build my application
I also noticed, if keep only 6 videos, then they work fine. If I put more than 6, then I start seeing the issue
seems to be a known issue stackoverflow.com/questions/25249578

swt browser diplays pdf in new window

I'm experiencing a strange issue with the SWT browser widget.
I developed a multipage application using the "transition composite" widget from opal widgets.
In my last window I need to display a pdf.
I've been looking for free open source solutions on the web, and the only one I could fine was IcePdf but the renderization of the page was not great.
Then I found out I could use the browser widget to diplay a pdf.
I created a new project with the following code :
shell = new Shell();
shell.setSize(l, h);
Browser browser = new Browser(shell, SWT.NONE);
browser.setBounds(xb, yb, lb, hb);
browser.setUrl("file://" + pdfPath);
and it worked great.
But then if I run the same code in my actual application, it opens the pdf into adobe reader and not into the application itself.
Has anybody else noticed that issue before? And if yes how can I solve it?
Thanks in advice,
Stefano Franchini
I think there is an internet explorer or adobe reader setting which needs to be changed.
This might help:
If you want the browser to open PDF files in a separate Acrobat window, configure the browser to use Acrobat or Adobe Reader as a helper application. Then, when you select a PDF file in Internet Explorer, the browser will open the PDF file in an Acrobat window instead of the browser window.
To configure the browser to use Acrobat or Adobe Reader to open PDF files:
Quit Internet Explorer.
Start Acrobat or Adobe Reader.
Choose "Edit" > "Preferences."
Select Internet in the list on the left.
Deselect "Display PDF" in Browser, and click "OK."
Restart Internet Explorer.
Note: The next time you select a link to a PDF file, the browser may prompt you to open or save the file. If you choose to open the file, the browser opens the file in the helper application that you specified. If you choose to save the file, the browser downloads the file to the hard disk.
https://helpdesk.egnyte.com/hc/en-us/articles/201637224-How-Do-I-Open-PDF-Files-in-Adobe-and-Not-Internet-Explorer-
A different IE setting resolved this for me when running Eclipse 2019-03 and OpenJDK 11 (64-bit) on Windows 7:
Open Internet Explorer
Settings>>Manage add-ons>>Toolbars and Extensions..
Find the menu under Show in the lower-left, change to All add-ons
Find Adobe PDF Reader under the Adobe Inc. section, near the top of the right-hand pane
Change the Status from Disabled to Enabled
Hit Close button
Then try running your SWT Browser instance again with the browser.setURL() as the absolute path of the PDF file to be shown. Don't forget to call browser.update() after setting the URL/path so the SWT component is re-rendered.
(I know, it's been years on this question but I just ran into it and figured out a new solution which I could not find elsewhere on SO, so wanted to capture this in the hopes of helping someone else who might come across this issue in their work).

SVG viewer alternative for flash rendering in IE

Hi i have a problem with svg viewer in Internet Explorer, because i use flash, maybe you can suggest me another solution for this browser.
The Chrome Plugin for Internet Explorer is very seamless. We use it in several projects and have been able to display a simple error message to the user indicating that they need to install the plugin.

Categories

Resources