注册 登录
编程论坛 ASP技术论坛

百分帖---------小问题撒分

孤独冷雨 发布于 2010-04-13 11:30, 1185 次点击
有兄弟知道PDF电子书怎么能让他在网站页面上看啊!
就像豆丁网这样的!
http://www.
17 回复
#2
gupiao1752010-04-13 11:36
这个难度不低啊,相关资料我估计还是处于保密阶段!继续顶起!
#3
longxuanxuan2010-04-13 13:23
PDF 格式的.................难度!!!!
#4
james2309322010-04-13 14:00
这个啊..? 不知道..
#5
孤独冷雨2010-04-13 14:28
老板要把自己门户网上技术资料PDF电子书也做成这样的,增加网站流量防止别人下载。
给我一千块的工资,让我做五千块工资的事!真他奶奶的不讲理。
#6
yms1232010-04-13 15:46
这个是Flash编程制作的,好像是使用Flash的ActionScript读取PDF文档,还真没接触过.
http://bbs.
网上搜索到的帖子希望有帮助。
#7
孤独冷雨2010-04-13 17:12
搞不定啊!有会的吗?
#8
yms1232010-04-13 17:21
http://prj.
发现CSDN也有同样想要那个文档播放器的。
#9
ASP_boy2010-04-13 21:19
这个难度不小,应该需要一些控件和播放器吧。
具体帮不上斑竹什么忙。见谅
#10
孤独冷雨2010-04-14 08:25
http://www.

http://www.

在这个外包网上,也做这个功能,几家软件公司全落选择了,实现不了这功能!
老板硬是要我实现,我操,一个月那么点工资他也好意思!
#11
qingzhu57532010-04-14 09:48
package com.zhaipuhong.j2se.pdf;   
  
import    
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;   
    }   
}  

package com.zhaipuhong.j2se.pdf;

import
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;
    }
}
#12
cnfarer2010-04-14 10:24
回复 楼主 孤独冷雨
我的判断:这个是用Flash做的,会Flash的话,就应该知道能不能做啊!(我不熟悉Flash,但觉得是可以用控件来实现的)
#13
孤独冷雨2010-04-14 14:14
回复 11楼 qingzhu5753
看不懂啊兄弟,偶只会ASP!
#14
yms1232010-04-15 11:27
Java能实现的话,可以使用JavaApplet小应用程序嵌入网页来实现也是个好办法。
#15
孤独冷雨2010-04-15 16:32
真不知道怎么搞好了!搞不出来啊!
#16
cnfarer2010-04-16 08:15
回复 15楼 孤独冷雨
把那个丁豆什么的网站上的SWF下下来,反编,研究就行了!
#17
sky2222010-04-16 11:18
帮顶一下,
#18
孤独冷雨2010-04-16 11:52
回复 16楼 cnfarer
呵呵!想的太简单了!
1