java²Ù×÷pdf£¨½â¾öÖÐÎĵ¼³öÎÊÌ⣩
Java iText ¶¯Ì¬ Éú³É PDF Îĵµ ±í¸ñ ÖÐÎÄÎÊÌâ
iTextÊÇÒ»¸ö¿ª·¢Ô´´úÂëµÄÏîÄ¿£¬Äã¿ÉÒÔʹÓÃiText·½±ãµÄʵÏÖPDFµÄÊä³ö¡£
Ò»¡¢iTextµÄÏÂÔØ£º
Äã¿ÉÒÔÔÚ http://www.lowagie.com/iText/ ²é¿´¹ØÓÚiTextµÄÏà¹ØÐÅÏ¢£¬°üÀ¨Ô´´úÂ룬Îĵµ..
1. itext-src-1.4.zip£¨Ô´´úÂ룩
http://jaist.dl.sourceforge.net/sourceforge/itext/itext-src-1.4.zip
2. itext-1.4.jar£¨¿ÉÒÔÖ±½Óµ¼ÈëµÄjarÎļþ£©
http://jaist.dl.sourceforge.net/sourceforge/itext/itext-1.4.jar
3. ÑÇÖÞÓïÑÔ°ü
http://itextdocs.lowagie.com/downloads/iTextAsian.jar £¨»òÕߣ©
http://itextdocs.lowagie.com/downloads/iTextAsianCmaps.jar
¶þ¡¢Ê¾Àý³ÌÐò£º
Ê×ÏÈ°ÑÉÏÃæµÄÕ⼸¸öjar°üµÄÍêÕû·¾¶Ìí¼Óµ½»·¾³±äÁ¿ classpath ÖУ¬È»ºóÔÙÏÂÃæµÄ³ÌÐò
Öе¼ÈëÏàÓ¦µÄ°ü
/**
* HelloWorld.java
*/
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
// ´´½¨Ò»¸öDocument¶ÔÏó
Document document = new Document();
try
{
// Éú³ÉÃûΪ HelloWorld.pdf µÄÎĵµ
PdfWriter.getInstance(document, new FileOutputStream("HelloWorld.pdf"));
// Ìí¼ÓPDFÎĵµµÄһЩÐÅÏ¢
document.addTitle("Hello World example");
document.addAuthor("Bruno Lowagie");
document.addSubject("This example explains how to add metadata.");
document.addKeywords("iText, Hello World, step 3, metadata");
document.addCreator("My program using iText");
// ´ò¿ªÎĵµ£¬½«ÒªÐ´ÈëÄÚÈÝ
document.open();
Ïà¹ØÎĵµ£º
ºÜÖǻۣ¬ÆÄÓÐÊýѧÖÐÎÞÇî·ÖÎöµÄÒâζ
Õæ°®ËÀjavaÁË
public class FunnyNumbers {
public static void main(String[] args) {
double largeNum = (int)Math.exp(4000.0);
//int ²»Äܳý0
//Exception in thread "main" java.lang.ArithmeticException: / by zer oat FunnyNumbers.main(FunnyNumbers.j ......
import java.util.ArrayList;
import java.util.List;
public class FenYe
{
static double allpage=0; //×ÜÒ³Êý
static double currpage=0; //µ±Ç°Ò³
static double pagesize=10; //ÏÔʾÐÐ
static int sta ......
×î½üÏîÄ¿ÖÐÓÐÐèÒªÓõ½¹É¼Û£¬ÓÚÊÇÔÚÍøÉÏÕÒÁËÒ»·¬£¬Ã»ÓÐÒ»¸öÖ±½Ó¾ÍÄÜÓõġ£×Ô¼ºÃþË÷ÁËһϣ¬ÖÕÓڸ㶨һ¸ö¹Ë´ó¼Ò²Î¿¼¡£
package test;
import java.util.Arrays;
import javax.xml.namespace.QName;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
/**
*
* ¹¦ÄܸÅÊö£º<br>
* ......
ÊÂʵÉÏÍøÂç±à³Ì¼òµ¥µÄÀí½â¾ÍÊÇÁ½Ì¨¼ÆËã»úÏ໥ͨѶÊý¾Ý¶øÒÑ¡£¶ÔÓÚ³ÌÐòÔ±¶øÑÔ£¬È¥ÕÆÎÕÒ»ÖÖ±à³Ì½Ó¿Ú²¢Ê¹ÓÃÒ»ÖÖ±à³ÌÄ£ÐÍÏà¶Ô¾Í»áÏԵüòµ¥µÄ¶àÁË¡£Java SDKÌṩһЩÏà¶Ô¼òµ¥µÄApiÀ´Íê³ÉÕâЩ¹¤×÷£¬Socket¾ÍÊÇÆäÖÐÖ®Ò»¡£
¶ÔÓÚJava¶øÑÔ¡£ÕâЩApi´æÔÚÓëJava.netÕâ¸ö°üÀïÃæ¡£Òò´ËÖ»Òªµ¼ÈëÕâ¸ö°ü¾Í¿ÉÒÔ×¼±¸ÍøÂç±à³ÌÁË¡£ÍøÂç± ......
¡¡ÔÚJavaÓïÑÔÖУ¬ abstract class ºÍinterface ÊÇÖ§³Ö³éÏóÀඨÒåµÄÁ½ÖÖ»úÖÆ¡£ÕýÊÇÓÉÓÚÕâÁ½ÖÖ»úÖƵĴæÔÚ£¬²Å¸³ÓèÁËJavaÇ¿´óµÄ ÃæÏò¶ÔÏóÄÜÁ¦¡£abstract classºÍinterfaceÖ®¼äÔÚ¶ÔÓÚ³éÏóÀඨÒåµÄÖ§³Ö·½Ãæ¾ßÓкܴóµÄÏàËÆÐÔ£¬ÉõÖÁ¿ÉÒÔÏ໥Ìæ»»£¬Òò´ËºÜ¶à¿ª·¢ÕßÔÚ½ø ÐгéÏóÀඨÒåʱ¶ÔÓÚabstract classºÍinterfaceµÄÑ¡ÔñÏԵñȽÏËæ ......