本帖最后由 elfwarden 于 2013-06-09 13:15:45 编辑

解决方案 »

  1.   

    PDF 的文字取出来  显示到浏览器
      

  2.   

    能具体说明下需要使用什么方法或工具么?另外pdf的文字是有格式的,显示的和原pdf样式能否一样呢?
      

  3.   

    public void ExportPdfToPage(string strFileName)
        {
            try
            {
                //read all bytes
                if (File.Exists(strFileName) == false)
                    throw new Exception("This report is not created");
                FileStream fs = File.Open(strFileName, FileMode.Open);
                byte[] buffer = new byte[fs.Length];
                fs.Read(buffer, 0, buffer.Length);            fs.Close();
                //write to response
                Response.ContentType = "application/pdf";
                Response.AddHeader("content-disposition", "filename=123.pdf");
                Response.AddHeader("content-length", buffer.Length.ToString());
                Response.BinaryWrite(buffer);
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
            finally
            {
                Response.Flush();
                Response.Close();
                Response.End();
            }
        }将全路径传入到这个方法,就可以直接在浏览器中查看PDF
      

  4.   


    是一个ocx,首先需要安装pdf阅读器
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
        <title>Untitled Page</title>
    </head>
    <body style="margin:0px;">
    <DIV id="showdiv">
    <object classid="clsid:CA8A9780-280D-11CF-A24D-444553540000" width="100%" height="95%" border="0" name="pdf"> 
            <param name="toolbar" value="false">
          <param name="_Version" value="65539">       <param name="_ExtentX" value="20108">       <param name="_ExtentY" value="10866">       <param name="_StockProps" value="0">       <param name="SRC" value="工作周报第14期(48)1.pdf"> 
    </object> 
    <p style="text-align:center">
    <input type=button name=print value="打印" onclick="pdf.print()">
    <input type=button name=test  value="关闭" onclick="window.close()"></p>
    </DIV>
    </body>
    </html>