Mega Code Archive

 
Categories / Java Tutorial / PDF
 

Not Embedded font

import java.io.FileOutputStream; import com.lowagie.text.Document; import com.lowagie.text.Font; import com.lowagie.text.Paragraph; import com.lowagie.text.pdf.BaseFont; import com.lowagie.text.pdf.PdfWriter; public class MainClass {   public static void main(String[] args) throws Exception {     Document document1 = new Document();     PdfWriter.getInstance(document1, new FileOutputStream("font_not_embedded.pdf"));     document1.open();     BaseFont bf_not_embedded = BaseFont.createFont("c:\\windows\\fonts\\comic.ttf",         BaseFont.CP1252, BaseFont.NOT_EMBEDDED);     Font font_not_embedded = new Font(bf_not_embedded, 12);          document1.add(new Paragraph("quick brown fox jumps over the lazy dog", font_not_embedded));     document1.close();   } }