Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
460 views
in Technique[技术] by (71.8m points)

map - Embed font into PDF file by using iText

I defined a tag map, and got a XML data file. I want to convert the XML data file to PDF by using iText. The question is how to embed fonts (e.g. Polish font, Chinese font) into the target PDF when converting XML to PDF?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If you are doing more work with iText, you may want to invest into the iText book - it has examples for all the features of iText.

There is a parameter that you specify when you create your font that defines font embedding:

BaseFont helvetica = BaseFont.createFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED);
Font font = new Font(helvetica, 12, Font.NORMAL);

You can find more iText font related examples here: http://1t3xt.info/examples/browse/?page=toc&id=14


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...