Java/PDF RTF/GState
Версия от 18:01, 31 мая 2010; (обсуждение)
GState Demo
import java.awt.Color;
import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfGState;
import com.lowagie.text.pdf.PdfWriter;
public class GStatePDF {
public static void main(String[] args) {
Document document = new Document();
try {
PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("GStatePDF.pdf"));
document.open();
PdfContentByte cb = writer.getDirectContent();
PdfGState gs = new PdfGState();
gs.setFillOpacity(0.5f);
cb.setGState(gs);
cb.setColorFill(Color.red);
cb.circle(360.0f, 500.0f, 250.0f);
cb.fill();
gs.setFillOpacity(0.2f);
cb.setGState(gs);
cb.setColorFill(Color.blue);
cb.circle(460.0f, 500.0f, 100.0f);
cb.fill();
} catch (Exception e) {
System.err.println(e.getMessage());
}
document.close();
}
}