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();
Ïà¹ØÎĵµ£º
//´«µÝ²ÎÊý£¬ºÍcÖд«µØÖ·ÓеãÏñ
public class ArrayParameters {
public static void changeOrNot (int i, double[] x) {
i =-1;
x[0] = -2.0;
double[] y = x;
y[1] = -3.0;
double[] z = {4.0, 4.0, 4.0};
x = z;
}
public static void main (String[] args) {
String s1 = ......
Java´úÂë
import java.util.Timer;
import java.util.TimerTask;
import java.util.Timer;
import java.util.TimerTask;
Java´úÂë
public class Test {
public static void main(String[] args) { ......
1 ËùÓÐµÄ .java|.jsp|.html|.xml Ô´Îļþ¾ùʹÓÃutf-8±àÂë¸ñʽ±£´æµ½ÏµÍ³´ÅÅÌ¡£
È磺ÔÚEclipseÖбà¼Îļþ£¬Ñ¡ÖÐÎļþ´ò¿ªÓÒ¼ü²Ëµ¥Ñ¡ÔñÊôÐÔ£¬½«Îı¾Îļþ±àÂëÉèÖÃΪÆäËû²¢Ñ¡ÔñUTF-8£»Ò²¿ÉÒÔÔÚ
Eclipse——Ê×Ñ¡Ïî——³£¹æ——ÄÚÈÝÀàÐÍÖÐÉèÖø÷ÖÖÎļþµÄȱʡ±àÂ룬ÕâÑùÒÔºóËùÓеÄÎı¾Îļþ¶¼Ê¹ÓÃÍ³Ò ......
Ò»¸öÓÅÐãµÄJava³ÌÐòÔ±±ØÐëÁ˽âGCµÄ¹¤×÷ÔÀí¡¢ÈçºÎÓÅ»¯GCµÄÐÔÄÜ¡¢ÈçºÎÓëGC½øÐÐÓÐÏ޵Ľ»»¥£¬ÒòΪÓÐһЩӦÓóÌÐò¶ÔÐÔÄÜÒªÇó½Ï¸ß£¬ÀýÈçǶÈëʽϵͳ¡¢ÊµÊ±ÏµÍ³µÈ£¬Ö»ÓÐÈ«ÃæÌáÉýÄÚ´æµÄ¹ÜÀíЧÂÊ £¬²ÅÄÜÌá¸ßÕû¸öÓ¦ÓóÌÐòµÄÐÔÄÜ¡£±¾ÆªÎÄÕÂÊ×Ïȼòµ¥½éÉÜGCµÄ¹¤×÷ÔÀíÖ®ºó£¬È»ºóÔÙ¶ÔGCµÄ¼¸¸ö¹Ø¼üÎÊÌâ½øÐÐÉîÈë̽ÌÖ£¬×îºóÌá³öһЩJava³ÌÐòÉ ......
package com.test.util;
import java.sql.*;
public class ConnectDB {
private Connection conn=null;
private PreparedStatement pt=null;
private ResultSet rs=null;
private String uname="sa";
private String upwd="sa";
private String url="jdbc:microsoft:sqlserv ......