RT

解决方案 »

  1.   

    什么流?
    写好的pdf流
    还是只是数据的?
    如果是只是数据的话你看看rdl这个东西
    网上有源代码
    如果是合并的话
    我到是有代码
      

  2.   

    如果是合并的话
    我到是有代码代码我看看!
    [email protected]
      

  3.   


    public  class PDFBook
    {
        
        private string _bookname;
        private short _pagecount;
        private string[] _chaptername;
        private string _isbn;
        private string[][] _content;
        private string _summary;
        private string _publishingname;
        private string _writer;
        private DateTime _date;
        public  string BooKName
        {
            get { return _bookname; }
            set { _bookname = value; }
        }
        public string Writer
        {
            get { return _writer; }
            set { _writer = value; }
        }     public   short   PageCount
         {
             get { return _pagecount; }
             set { _pagecount = value; }
         }
         
         public    string[] ChapterName
         {
             get { return _chaptername; }
             set { _chaptername = value; }
         }
         public    string ISBN
         {
             get { return _isbn; }
             set { _isbn = value; }
         }
        public string[][] Content
        {
            get { return _content; }
            set { _content = value; }
        }     public    string Summary
         {
             get { return _summary; }
             set { _summary = value; }
         }
         public    string PublishingName
         {
             get { return _publishingname; }
             set { _publishingname = value; }
         }     public    DateTime Date
         {
             get { return _date; }
             set { _date = value; }     }
        
        public PDFBook()
        { 
        
        }
    }
      

  4.   

     public static void Main()
        {
            Document co = new Document();
            PDFBook pdfbook = new PDFBook();
            pdfbook.BooKName = "新的一天";
            pdfbook.ChapterName = new string[5];
            pdfbook.ChapterName[0] = "第一天";
            pdfbook.ChapterName[1] = "第二天";
            pdfbook.ChapterName[2] = "第三天";
            pdfbook.ChapterName[3] = "第四天";
            pdfbook.ChapterName[4] = "第五天";
            pdfbook.PageCount = 554;
            pdfbook.Writer = "ZTX";
            pdfbook.PageCount = 5;
            pdfbook.Content = new string[5][];
            pdfbook.Content[0] = new string[2];
            pdfbook.Content[1] = new string[2];
            pdfbook.Content[2] = new string[3];
            pdfbook.Content[3] = new string[4];
            pdfbook.Content[4] = new string[5];
            pdfbook.Summary = "我也写了一本书";
            pdfbook.ISBN = "000000001";
            pdfbook.Date = DateTime.Now;
    //如何把这个对象传送给另外一个方法,另外一个方法就是接受对象生成pdf文件!!
    怎么弄?    }
      

  5.   

        pdfbook.PageCount = 554;应该是16
      

  6.   

     public static void CreatePDFFile(PDFBook book, string strPass)
        { 
        
        }
      

  7.   

    LZ前一个贴子(http://topic.csdn.net/u/20080529/08/c6bd6852-c53a-4a8c-aae4-f0c1311bbd62.html?793735227)7楼的解答就是可行的解决方案。
      

  8.   

    我不了解pdf的语法,他的那个代码只能简单生成pdf(仅仅是文字),实现不了我的需求!
      

  9.   

    http://www.codeproject.com/KB/cs/giospdfsplittermerger.aspx?fid=247540&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=1
      

  10.   

    //**************************************
    // Name: Create in memory PDF documents in ASP.NET using Apache NFOP
    // Description:The sample demonstrates how to create PDF documents in memory using the open source Apache NFOP(http://sourceforge.net/projects/nfop/) and stream the same to browser instead of saving the PDF documents to harddrive.
    // By: Azeet Chebrolu
    //
    //
    // Inputs:Path to your XML Data File and Path to the XSLT Transformation file.
    //
    // Returns:None
    //
    //Assumes:Add reference to ApacheFop.Net.dll and vJsLib.dll which comes with Visual J#.net
    //
    //Side Effects:None
    //**************************************using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.IO;
    using System.Xml;
    using System.Xml.Xsl;
    using System.Xml.XPath;
    using org.apache.fop;
    using org.apache.fop.apps;
    using org.apache.fop.tools;
    using org.xml.sax;
    using java.io;
    using System.Text;public partial class output : System.Web.UI.Page
    {
     protected void Page_Load(object sender, EventArgs e){}
     protected void Button1_Click(object sender, EventArgs e)
     {
      StreamPDF(Server.MapPath("CP0000001.xml"), Server.MapPath("pdf.xslt"));
     }
     private static void StreamPDF(string XMLFile,string XSLTFile)
     {
      // Load the style sheet.
      XslCompiledTransform xslt = new XslCompiledTransform();
      xslt.Load(XMLFile);
      XmlDocument objSourceData = new XmlDocument();  //Load the Source XML Document
      objSourceData.Load(XSLTFile);  // Execute the transform and output the results to a file.
      MemoryStream ms = new MemoryStream();
      xslt.Transform(objSourceData, null, ms);  //Convert the Byte Array from MemoryStream to SByte Array
      sbyte[] inputFOBytes = ToSByteArray(ms.ToArray());
      InputSource inputFoFile = new org.xml.sax.InputSource(new ByteArrayInputStream(inputFOBytes));
      ByteArrayOutputStream bos = new java.io.ByteArrayOutputStream();
      org.apache.fop.apps.Driver dr = new org.apache.fop.apps.Driver(inputFoFile, bos);
      dr.setRenderer(org.apache.fop.apps.Driver.RENDER_PDF);
      dr.run();  //Convert the SByte Array to Byte Array to stream to the Browser
      byte[] getBytes = ToByteArray(bos.toByteArray());
      MemoryStream msPdf = new MemoryStream(getBytes);
      Response.ContentType = "application/pdf";
      Response.AddHeader("Content-disposition", "filename=output.pdf");
      Response.OutputStream.Write(getBytes, 0, getBytes.Length);
      Response.OutputStream.Flush();
      Response.OutputStream.Close();
     } private static SByte[] ToSByteArray(Byte[] source)
     {
      sbyte[] sbytes = new sbyte[source.Length];
      System.Buffer.BlockCopy(source, 0, sbytes, 0, source.Length);
      return sbytes;
     } private static Byte[] ToByteArray(SByte[] source)
     {
      byte[] bytes = new byte[source.Length];
      System.Buffer.BlockCopy(source, 0, bytes, 0, source.Length);
      return bytes;
     }
     public static string GetStringFromStream(Stream stream)
     {
      // Create a stream reader.
      stream.Seek(0, SeekOrigin.Begin);
      using (StreamReader reader = new StreamReader(stream))
      {
       // Just read to the end.
       return reader.ReadToEnd();
      }
     }
    }
      

  11.   

    using org.apache.fop;
    using org.apache.fop.apps;
    using org.apache.fop.tools;
    using org.xml.sax;
    using java.io;........................
    ..........................java.io都来了..............
      

  12.   

    using java.io;
    ??
    J# ?