PDF RTF Java

import java.io.FileOutputStream;
import com.lowagie.text.Document;
import com.lowagie.text.Element;
import com.lowagie.text.Image;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;
public class DrawLineUsingPdfContentBytePDF {
  public static void main(String[] args) throws Exception{
      Rectangle pageSize = new Rectangle(780, 525);
      Document document = new Document(pageSize);
      PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("DrawLineUsingPdfContentBytePDF.pdf"));
      document.open();
      PdfContentByte cb = writer.getDirectContent();
      cb.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA, BaseFont.WINANSI, false), 24);
      cb.moveTo(370, 0);
      cb.lineTo(370, 525);
      cb.moveTo(410, 525);
      cb.lineTo(410, 0);
      cb.stroke();
      document.close();
  }
}
           
       
itext.zip( 1,748 k)