⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 testmain.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
字号:
package com.sxit.wap.threads;
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.html.HtmlWriter;
import com.lowagie.text.pdf.BaseFont;
import java.awt.Color;
import java.util.Properties;

public class TestMain {
	public static void main(String[] args) {
		String sss =new java.text.SimpleDateFormat("yyMMddHHmmssZ").format(new java.sql.Timestamp( System.currentTimeMillis()));
		System.out.println( System.currentTimeMillis());
		System.out.println( System.currentTimeMillis());
		sss =new java.text.SimpleDateFormat("yyMMddHHmmss_ZZZ").format(new java.sql.Timestamp( System.currentTimeMillis()));
		System.out.println(sss);

	}

	public static void main1 ( String[] args ) {
		Rectangle pageSize = new Rectangle ( 100, 300 );
		pageSize.setBackgroundColor ( new java.awt.Color ( 0xFF, 0xFF, 0xDE ) );

		Document document = new Document ( pageSize );
		try {

			PdfWriter.getInstance ( document, new FileOutputStream ( "g:\\Chap0105.pdf" ) );
			document.open ();

			String chinese = "你好";
			BaseFont bfChinese = BaseFont.createFont("STSongStd-Light","UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
			Font FontChinese = new Font ( bfChinese, 5, Font.BOLD );;
			document.add(new Paragraph("大家好", FontChinese));
			Paragraph chunk = new Paragraph ( chinese, FontChinese );
			//document.add ( chunk );

		} catch ( DocumentException e1 ) {
			e1.printStackTrace();
		} catch ( IOException e2 ) {
			e2.printStackTrace();
		}
		document.close ();
	}
	public void writeToPdf (java.io.OutputStream out ,Document document) throws Exception {
		//response.setContentType( "application/pdf");
		//out = response.getOutputStream()
		ByteArrayOutputStream buffer = new ByteArrayOutputStream();
		PdfWriter writer = PdfWriter.getInstance( document, buffer );

		DataOutput output = new DataOutputStream(out);
		byte[] bytes = buffer.toByteArray();
		//response.setContentLength(bytes.length);
		output.write(bytes);
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -