Opening a pdf document in a new window on click of commandLink in ADF
Hi,
I am having a command link in my page and on click of that i am calling a webservice and getting the contents as bytes and writing the contents to the response outputstream. And i followed the below given steps. Everything works fine and i am getting the PDF displayed in new window. But i am getting a pop up blocker issue in IE and Firefox. Is there any workaround for that?
1: open a dialog , and get url of servlet
<af:commandButton text="Dialog Report" id="cbdialogReport"
action="#{ReportBean.cbdialogReport_action}"
useWindow="true" windowHeight="1000"
windowWidth="1100"/>
public String cbdialogReport_action() {
try {
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext =
facesContext.getExternalContext();
HttpServletRequest request = (HttpServletRequest)externalContext.getRequest();
String strUrl = request.getRequestURL() + "";
int iPosition = strUrl.indexOf("/faces/");
strUrl = strUrl.substring(0,iPosition+6) + "/doreport";
this.reportURL = strUrl;
System.out.println("strUrl=" + strUrl);
//System.out.println("request.getRequestURI()= " + request.getRequestURI());
return "dialog:ReportDialog";
} catch (Exception ex) {
System.out.println(ex);
return null;
2:diaolog
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document id="d1">
<af:form id="f1">
<af:panelStretchLayout id="psl1">
<f:facet name="bottom"/>
<f:facet name="center">
<af:inlineFrame id="if1"
source="#{ReportBean.reportURL}"/>
</f:facet>
<f:facet name="start"/>
<f:facet name="end"/>
<f:facet name="top"/>
</af:panelStretchLayout>
</af:form>
</af:document>
</f:view>
</jsp:root>
3: create a serlet
package com.pansoft.myerp.servlet;
import com.pansoft.myerp.view.Function;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.sql.Connection;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.*;
import javax.servlet.http.*;
import net.sf.jasperreports.engine.JasperRunManager;
public class doReport extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=UTF-8";
public void init(ServletConfig config) throws ServletException {
super.init(config);
/**Process the HTTP doGet request.
public void doGet(HttpServletRequest request,
HttpServletResponse response) throws ServletException,
IOException {
try
FacesContext facesContext = FacesContext.getCurrentInstance();
ExternalContext externalContext =
facesContext.getExternalContext();
//String strUrl = request.getRequestURL() + "";
//System.out.println("URL: " + strUrl);
response.setContentType("application/pdf");
response.addHeader("Content-Type", "application/pdf");
//response.setHeader("Content-Type", "application/pdf");
//response.addHeader("Content-Disposition", "inline;filename=Report.pdf");
Function function = new Function();
Connection conn = function.getCurrentConnection();
OutputStream outputStream = response.getOutputStream();
InputStream reportStream = externalContext.getResourceAsStream("/Report/rptChar.jasper");
JasperRunManager.runReportToPdfStream(reportStream, outputStream, null, conn);
outputStream.flush();
outputStream.close();
//facesContext.responseComplete();
}catch(Exception ex) {
System.out.println("doGet():" + ex);
Thanks!
Ram
I think you can't anything do about it if your popup blocker prevents the page to open.
Some such blockers allow to add white lists of url which are allowed to open popups.
Timo
Similar Messages
-
How can I force browser to open a pdf document in a new tab from another online pdf document?
Hello everybody,
I create the internal magazine in InDesign. Then I create a pdf document in which there are some URL. After having verified that every link works, I upload this pdf on our website to be read online. The pdf document opens in the browser.
The problem is that when people read the pdf, they click on the links but they open in the same tab than my pdf.
What can I do to make sure that every link opens in a new tab?
My apologies for English mistakes and thank you for your answers.I already found the Javascript solution in Acrobat... It works more or less (layout problems), but it's impossible to do one by one as I have many links in my doc...
I don't understand why it's not possible to make it directly with InDesign before exporting it in pdf or while exporting it. There should be an option in the "new hyperlink" dialog box or in the pdf parameters.
Does someone have another idea? -
Open a pdf file in a new window
How do you have a pdf file open up in a new window in
DW8?If you are coding a page with a HTML Transitional doctype,
you can link to
the PDF file, and assign a target="_blank" option to the
link. If you are
coding a page with an XHTML doctype, then you would need to
do this
differently if you want the page to validate.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
==================
"omealh" <[email protected]> wrote in
message
news:giocbd$rm6$[email protected]..
> How do you have a pdf file open up in a new window in
DW8? -
Running Firefox beta and Adobe Acrobat 10. If I open a PDF document in a new tab, say http://support.avaya.com/css/P8/documents/100146419, and then try and close the tab using ctrl-w, I get the message warning me about closing all tabs. If I switch to another tab and then back to the PDF document and then hit ctrl-w, it will just close that one tab and not all tabs.
Cheers.I've just been playing around and I set dom.ipc.plugins.enabled to true and now it closes the PDF document but not the tab. I have to do ctrl-w again to close the tab. However, leaving that set to true ruins the scroll mouse functionality as Acroread seems to want it all to itself.
-
Open a new window while clicking on the command button
Hi,
Can I open a pdf report in a new window when adf command button is clicked?
I am using jdev11g
ThanksHi John,
I found the goButton's destination expression do not read value from any controls e.g.: Input Text.
Is there anyway to read some value, that input by user not in the db, on the screen?
e.g.: I have a Input Text for user to input a date to print the report. I've tried to binding the control in backingBean, but I get a null value from the goButton's destination function.
the jspx:
<af:inputText label="Search" id="it1"
value="#{backingBeanScope.backing_goUrl.it1Value}" autoSubmit="true"/>
<af:goButton text="goButton 1" id="gb1" targetFrame="_blank"
destination="#{backingBeanScope.backing_goUrl.searchURL}"/>in the backing bean:
public class GoUrl {
private String it1Value;
public String getIt1Value() {
return it1Value;
public void setIt1Value(String it1Value) {
this.it1Value = it1Value;
public String getSearchURL() {
String s = getIt1Value();
return "http://www.google.com/search?hl=zh-tw&q="+s; // the result of s is always null.
}Cheers,
Samson Fu
Edited by: Samson Fu on Aug 31, 2010 1:46 PM -
To open a pdf document or word document from a JSP into a new window
Hi,
How to open a PDF document or word document from a JSP into a new window. i.e say from a jsp when a hyperlink or button is clicked it should open a new window with the pdf document or word document in it.
thanks in advance,
radki_jHi ,
when i tried to use the below code to open my word document , it will open as html and with some garbage details. Doesnt open as word document. How to solve this kind of probem?Need advice urgently.
Open Document -
When opening a pdf document in Adobe Reader the font of the original document is changed....It becomes a mix of the original font and a new different font. How can i fix this
This issue occurs with most of the PDFs that I open up. I am using the latest version of adobe reader on my windows based machine and it is a general PDF. I saw a similar post online stating that if you look at the fonts used in the document and it doesn't say (Embedded) next to it, then Adobe Reader will try to pull the font(s) from your computer and if it doesn't find that font then it will replace it which makes it look funny.
-
Open several PDFs in the same Reader window using tabs for each document
How do I open several PDFs in the same Reader window using tabs for each document? I'm using Reader 11.0.03 and Windows 7.
That would be a nice feature! Suggest it at https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform - hopefully it will make it into Reader XII.
-
== Issue
==
Firefox is having problems with certain web sites
== Description
==
Sometimes (but not always), when I try to open a pdf document from the US bankruptcy court website, I get a window asking if I want to use Adobe Acrobat. After I click "yes", I get a bland screen.
== URL of affected sites
==
http://
== Troubleshooting information
==
Firefox Version
3.6.3
Extensions
Name
Version
Enabled
ID
Skype extension for Firefox 2.2.0.70 false
Java Console 6.0.01 false
Java Console 6.0.02 true
== Firefox version
==
3.6.3
== Operating system
==
Windows 7
== User Agent
==
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
== Plugins installed
==
*-Office Plugin for Netscape Navigator
*Download and Print Plug-in DLL
*Default Plug-in
*Shockwave Flash 10.0 r45
*Adobe PDF Plug-In For Firefox and NetscapeHi.
Does this only open on that specific site?
In any case, you may want to:
- instruct Firefox to handle PDF files in a specific way by going into Tools > Options > Applications and selecting the option you want for the PDF files
- reinstall Adobe Reader and its Firefox plugin
- install another reader instead of Adobe Reader. I recommend Foxit Reader ( http://www.foxitsoftware.com/pdf/reader/ ), since it's free, VERY light, VERY fast, safe and also has a Firefox plugin (make sure you don't have both Adobe Reader plugin and Foxit Reader plugin enabled/installed at the same time in Firefox) -
I have the preview pane active when selecting PDF Documents. When I open a PDF document I am unable to save any changes. the error message I receive:
"The documents could not be saved. The file ma be read-only,or another user may have it open. Please save the document with a different name of in a different folder"
The document is not read only and no other user has it open. If I turn the preview pane OFF there is no problem saving changes. I have also un-installed Adobe Reader.
Other programs (such as Excel, Word) do not experience the same problems as the PDF documents.
Does anyone have a solution?Hi snoreaustralia,
It sounds like you just need to associate the PDF filename extension with Acrobat, rather than Preview. Please see this document from the Microsoft Help for instructions on choosing the default program for opening a particular file type (in your case, PDF): Change which programs Windows uses by default - Windows Help
Best,
Sara -
Open a document in a new window
How can I open a document in a new window? I need to have 2 open windows, with the same document. In MS Office, its "open in a new window". Thanks!
KOENIG Yvan wrote:
Feature unavailable "inthebox"
This is why I wrote a script available on my idisk:
It is a good script, Yvan, for what it does. However, even with that script it is a long way to the full MS Word functionality. In MS Word, you can change the content in any of the open windows, and the modifications are instantly visible everywhere.
If you have a 20 page document, you can change the first page in one window, the last page in a second window and page 13 in a third window. If you change a style, the consequence of the style change is instantly visible in all three windows, so you can tell straight away if it works everywhere.
With your script, one gets just a read-only copy of the first document, as far as I can tell.
I persist: the full "New Window" function of MS Word is not available in Pages, not even with your otherwise good script. -
Just like 9.9/10 people out here in the real world, I use Adobe Reader to read pdf files and never (ever) use the Tool Pane for anything.
How do I permanently disable it from showing up, instead of having to close it *each & every time* I open a pdf document? The majority of people don't want thins thing covering up the page they are trying to read.Okay, seems I've stumbled upon an ugly workaround but it works for me. I'm using Windows 8.1. Go to the install directory, i.e." C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroApp\ENU". Create a new subfolder (I used "Disabled"). Move 3 files from the "ENU" folder into the new "Disabled" folder: AppCenter_R.aapp & Home.aapp & Viewer.aapp. Open a PDF and no more Tool Pane! I originally moved just the "Viewer" file but if you clicked on "Home" or "Tools" on the toolbar you couldn't go back to the "Document." Moving all 3 files takes care of that issue. Like a lot of people I don't and won't ever use any of the tools. I just want a reader. Let me know if this works for you.
-
I can't open any pdf documents with Adobe Reader XI...get an error that "Adobe has stopped working" then it closes. Is this an Adobe issue, Microsoft issue, or security issue?
Thank you! That seemed to do the trick. Don't think I'd ever have figured that one out!!
From: pwillener <[email protected]>
To: Sharon Atkins <[email protected]>
Sent: Monday, February 16, 2015 9:47 PM
Subject: I can't open any pdf documents with Adobe Reader XI...get an error that "Adobe has stopped working" then it closes. Any suggestions?
I can't open any pdf documents with Adobe Reader XI...get an error that "Adobe has stopped working" then it closes. Any suggestions?
created by pwillener in Adobe Reader - View the full discussionSince you mention Microsoft, I assume that you are on Windows. Can you open Reader by itself? If so, try disabling Protected Mode Edit . If the reply above answers your question, please take a moment to mark this answer as correct by visiting: https://forums.adobe.com/message/7201334#7201334 and clicking ‘Correct’ below the answer Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Please note that the Adobe Forums do not accept email attachments. If you want to embed an image in your message please visit the thread in the forum and click the camera icon: https://forums.adobe.com/message/7201334#7201334 To unsubscribe from this thread, please visit the message page at , click "Following" at the top right, & "Stop Following" Start a new discussion in Adobe Reader by email or at Adobe Community For more information about maintaining your forum email notifications please go to https://forums.adobe.com/thread/1516624. -
PDF output in a new window.
Hi All,
Thers an application in MVC where on clicking a button a popup comes with three options OPEN/SAVE/CANCEL .If the user clicks the OPEN button , a new window comes up with the PDF file icon in it .On clicking this PDF File icon the PDF document is opened in a new window.
Is it possibel to open the PDF document directly in a new window without giving the popup for OPEN/SAVE/CANCEL options?
I mean as soon as the user clicks the button the PDF document should open in a new window.
Thanks in advance .Hi Raja,
Many thanks for the reply.
I will go through the web logs and try out the solution.
I hope i ll make it. -
Can one set "Navigation Pane Buttons" Left Sidebar to 'Default Hidden' and 'Not Open' upon opening Any .pdf document?
Photoshop has to have full administrator rights to have read/write access.
This means you need to run Photoshop CS5.1 in an Administrator account and set it up to "Run as Administrator."
1. Close Photoshop if it's open.
2. Right click on your Photoshop CS5.1 launch icon then select "Run as Administrator" from the context menu. (You will have to enter Admin Password if UAC is enabled to change this setting.)
3. Launch Photoshop CS5.
4. See if you create and save a document.
Even if you are in an Administrator account you have to do this as Vista's Admin account isn't really the Super Admin as it is in XP so you have to elevate the rights by selecting "Run as Administrator". This setting is sticky so you should only have to do this once. I am not sure why CS3 is suddenly acting as if it does't have Admin rights unless you are running it in a new account that isn't an administrator or maybe uninstalled (cleanScript?) then reinstalled.
If can't create or save a document, check that the account that Photoshop is in is an Administrator account.
To check if you are in an Administrator account...
1. Type user account in your Vista or Windows7 start search bar. (Start search bar is at the bottom of the panel that opens when you click the start Windows start globe located on the far left hand side of your Windows task bar.)
2. Click on "User Accounts" which should show up at the top of the list. This will open the dialog to User Accounts where you can "Change Your Account Type". If UAC (User Account Control) is turned on, you will need to enter the Admin password to change this setting.
Maybe you are looking for
-
Is it possible to transfer music/videos from my itunes account to a grandchild (she will need her own account) I bought her music and videos and let her play with my ipod touch. Now she has an ipad.
-
Game Center displays real name not nickname to public, public profile is off. How do I change display to nickname?
-
IPod: Folder icon -- Disk Mode -- won't mount on desktop or iTunes
Hi all. I'm getting a folder icon with ex point on my iPod (see my pic for version). Reset doesn't work. The solution to that is to restore but when I plug into my computer it doesn't show up so I can't restore. Then it goes into "Disk Mode." Anyone
-
Adobe PDF printer - Use VBA??
I am using Microsoft Access 2003 and have Acrobat 7 (Adobe PDF) and Acrobat 5 (Adobe PDF Writer) installed on my machine. I can print to the Adobe PDF printer by using this code: Set Application.Printer = Application.Printers("Adobe PDF") DoCmd.Ope
-
Notifying the user about Fax error
HI Experts, We are sending the PO documents thro' Right Fax server. When the fax sending fails because of say wrong fax number, then we need to notify the sender of the fax. We have to send an email to the sender of the fax stating that the fax sendi