91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 1.42MB
    文件類型: .rar
    金幣: 2
    下載: 0 次
    發布日期: 2023-10-31
  • 語言: Java
  • 標簽: PDFRenderer??

資源簡介

如果生成PDF文件,大家估計會選擇iText jar包,但是如果想用在一個Panel上看PDF,就要選擇PDFRenderer.jar (貌似pdfbox也可以),現在將PDFRenderer jar包以及例子放到了一起,供大家參考

資源截圖

代碼片段和文件信息

package?panelView;

//import?com.sun.pdfview.PDFFile;
//import?com.sun.pdfview.PDFPage;
//import?com.sun.pdfview.PagePanel;
import?java.io.*;
import?java.nio.ByteBuffer;
import?java.nio.channels.FileChannel;
import?javax.swing.*;

import?org.pdfbox.pdfviewer.PDFPagePanel;

import?com.sun.pdfview.PDFFile;
import?com.sun.pdfview.PDFPage;
import?com.sun.pdfview.PagePanel;

/**
?*?An?example?of?using?the?PagePanel?class?to?show?PDFs.?For?more?advanced
?*?usage?including?navigation?and?zooming?look?ad?the?
?*?com.sun.pdfview.PDFViewer?class.
?*
?*?@author?joshua.marinacci@sun.com
?*/
public?class?Main?{

????public?static?void?setup()?throws?IOException?{
????
????????//set?up?the?frame?and?panel
????????Jframe?frame?=?new?Jframe(“PDF?Test“);
????????frame.setDefaultCloseOperation(Jframe.EXIT_ON_CLOSE);
????????PagePanel?panel?=?new?PagePanel();
????????frame.add(panel);
????????frame.pack();
????????frame.setVisible(true);

????????//load?a?pdf?from?a?byte?buffer
????????File?file?=?new?File(“C:\\Documents?and?Settings\\Administrator\\デスクトップ\\ー?~?教育記録-20090513.pdf“);
????????RandomAccessFile?raf?=?new?RandomAccessFile(file?“r“);
????????FileChannel?channel?=?raf.getChannel();
????????ByteBuffer?buf?=?channel.map(FileChannel.MapMode.READ_ONLY
????????????0?channel.size());
????????PDFFile?pdffile?=?new?PDFFile(buf);

????????//?show?the?first?page
????????PDFPage?page?=?pdffile.getPage(0);
????????panel.showPage(page);
????????
????}

????public?static?void?main(final?String[]?args)?{
????????SwingUtilities.invokeLater(new?Runnable()?{
????????????public?void?run()?{
????????????????try?{
????????????????????Main.setup();
????????????????}?catch?(IOException?ex)?{
????????????????????ex.printStackTrace();
????????????????}
????????????}
????????});
????}
}
????
????

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????2087109??2010-02-10?14:17??PDFRenderer.jar

?????文件???????1881??2010-02-10?14:19??Main.java

-----------?---------??----------?-----??----

??????????????2088990????????????????????2


評論

共有 條評論