Hi all,

First of all, thank you all for writing, supporting and maintaining iText 
and for answering my previous questions!

I have a PDF generated by someone else which I need to modify for them, to 
insert additional text. It would be very hard to regenerate this PDF from 
scratch using iText, but I could ask them to generate it again if it 
helps.

The text I need to add needs to be in a cursive (handwriting) font, I'm 
told. I don't think any of the standard 14 fonts will do.

I've read the PdfStamper example and used it to add the correct text in 
the correct place, but I can't seem to make it use my desired (local) 
font. I downloaded a free font for this purpose, and I know it can be 
embedded because the UsingFontFactory example works and shows the font 
correctly.

I'm not sure it's even possible to embed a font using PdfStamper to access 
the PdfContentByte objects with getOverContent, and if it is, I can't see 
how. I can create a Font object using:

        Font font = FontFactory.getFont("angelina");
        BaseFont bf = font.getBaseFont();
        PdfContentByte over  = stamper.getOverContent(1);
        over.beginText();
        over.setFontAndSize(bf, 30);

but it always shows up in a sans serif font. If I try to recreate the 
BaseFont with BaseFont.EMBEDDED, I get an exception:

        bf = BaseFont.createFont(bf.getPostscriptFontName(),
                bf.getEncoding(), BaseFont.EMBEDDED);

        com.lowagie.text.DocumentException: Font 'Angelina' with 'Cp1252'
        is not recognized.

I can't find an encoding that allows me to create a new BaseFont object in 
this way.

I read in the mailing list archive a post from 2003 which says that iText 
does not allow embedding new fonts in an existing document? Please tell me 
that this isn't the case any more? And is this the cause of my problem?

If so, can anyone advise me how the author of the document could ensure 
that the font I want is pre-embedded in the PDF file?

If it is possible to embed the font, please could someone point me in the 
right direction, given that I'm not familiar with the internals of PDF?

Thanks very much for your help.

Cheers, Chris.
-- 
_ ___ __     _
  / __/ / ,__(_)_  | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to