PDF

import java.io.FileNotFoundException;
import java.io.FileOutputStream;

import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Paragraph;
import com.lowagie.text.pdf.PdfWriter;



public class PDF {

	public static void main(String[] args){
		
		write();
	}
	
	public static void write(){
		
		Document document = new Document();
		try {
			PdfWriter.getInstance(document,new FileOutputStream("Helloworld.PDF"));
		} catch (FileNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (DocumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} 
		document.open();
		try {
			document.add(new Paragraph("HELLO"));
		} catch (DocumentException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		document.close();
		
	}
	
	
}

你可能感兴趣的:(PDF)