关于如何在网页里打开pdf文件

加入我点击按钮,后台生成一个pdf文件。

我不要它出现另存为的询问弹出框,而是在网页里直接显示,该如何实现?

要求如果本地没有安装adobe reader等软件,提示客户下载安装浏览器插件后显示。
[b]问题补充:[/b]
我曾经见过在网页里是可以打开单个pdf文件的

这个还不容易。把PDF文件写入response流里面就可以了!
方法有很多,这里给个独立又简单的例子:
[code="java"]
package com.zhaipuhong.j2se.pdf;

import java.io.IOException;
import java.util.Date;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfPTable;
import com.lowagie.text.pdf.PdfPCell;
import java.awt.Color;

public class PdfServlet extends HttpServlet {

private static final long serialVersionUID = -6033026500372479591L;

public void doGet (HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {

    // step 1  建立文档对象
    Document document = new Document();
    try {
            //设置文档相应类型
            response.setContentType("application/pdf");
            PdfWriter.getInstance(document, response.getOutputStream());


            // step 3  打开文档
            document.open();
            //支持中文
            BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
            com.lowagie.text.Font FontChinese = new com.lowagie.text.Font(bfChinese, 12, com.lowagie.text.Font.NORMAL);
            Paragraph pragraph=new Paragraph("你好", FontChinese);


            // step 4  向文档中添加内容
            document.add(pragraph);
            document.add(new Paragraph(" Hello World !"));
            document.add(new Paragraph("Date 时间"+new Date().toString()));
            document.add(new Paragraph(new Date().toString()));
            document.add(new Paragraph(new Date().toString()));



            PdfPTable table = new PdfPTable(3);
                    PdfPCell cell = new PdfPCell(new Paragraph("header with colspan 3"));
                    cell.setColspan(3);
                    table.addCell(cell);
                    table.addCell("1.1");
                    table.addCell("2.1");
                    table.addCell("3.1");
                    table.addCell("1.2");
                    table.addCell("2.2");
                    table.addCell("3.2");
                    cell = new PdfPCell(new Paragraph("cell test1"));
                    cell.setBorderColor(new Color(255, 0, 0));
                    table.addCell(cell);
                    cell = new PdfPCell(new Paragraph("cell test2"));
                    cell.setColspan(2);
                    cell.setBackgroundColor(new Color(0xC0, 0xC0, 0xC0));
                    table.addCell(cell);
                    document.add(table);

    }catch(DocumentException de) {
        de.printStackTrace();
        System.err.println("document: " + de.getMessage());
    }

    // step 5: 关闭文档对象
    document.close();
}

//支持中文
public Paragraph getChineseString(String chineseString){
  Paragraph pragraph=null;
  BaseFont bfChinese = null;
  try {
    bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H",
                                    BaseFont.NOT_EMBEDDED);
    com.lowagie.text.Font FontChinese = new com.lowagie.text.Font(bfChinese,
        12, com.lowagie.text.Font.NORMAL);
     pragraph = new Paragraph(chineseString, FontChinese);
  }
  catch (Exception ex) {
    ex.printStackTrace();
  }
  return pragraph;
}

}
[/code]

如果再生成一个jpg文件呢?
从来没在网页里见过嵌入pdf文件的

楼主见到的那种貌似只是一个ActiveX控件,也只能打开本地的文件。

能够直接在网页上面显示服务器端pdf的页面,目前还没有见到过。