Benjamin Podszun wrote: > Hi Leonard. > > Thanks for answering. > > On Tue, 2 Dec 2008 22:59:32 +0100, Leonard Rosenthol > <[EMAIL PROTECTED]> wrote: >> If you are doing hidden text on the OCR (which it appears you are), >> then you do NOT need to embed the font _IF_ you only use "Text Render >> Mode 3" when you draw the text. > > Okay, that's interesting and good to know, but: > > 1) My code currently throws an exception because I don't embed a font. This > happens in the following part, in the call to SetFontAndSize. > I need to call that method, because I want my text to be (roughly) the size > of the OCR region of the word, so that selecting the text gives the "right" > graphical boundaries. I understand that for this method I _have_ to embed > the font (it cannot know if I later on render the text invisible). If > there's a better way to have a text information with a given region, please > share it! > > My relevant code for just that (embedding the invisible text with the right > size): >>> content.BeginText(); >>> // EXCEPTION BELOW >>> content.SetFontAndSize(font, fontSize); >>> // EXCEPTION ABOVE >>> content.SetTextRenderingMode( >>> PdfContentByte.TEXT_RENDER_MODE_INVISIBLE); >>> content.SetTextMatrix( >>> (float)(ocrWord.Rectangle.Location.X * horizontalScaling), >>> pageImage.ScaledHeight - (float)(ocrWord.Rectangle.Bottom * >>> verticalScaling)); >>> content.ShowText(ocrWord.Data); >>> content.EndText(); > > 2) I still don't get why the font is not embedded with the snippet below. > What could I do to _actually_ embed the font? Am I missing something here? > Am I (quite certainly I am..) doing something stupid? > > My relevant code for the font creation, which doesn't seem to embed it > though. >>> // POSSIBLE CAUSE HERE: >>> // This is the font I'm using. It's only used for invisible rendering >>> // anyway The "embedded" parameter is true, but Visual Studio shows >>> // me that the resulting BaseFont instance's "embedded" member is >>> // set to false when I debug this? >>> BaseFont font = BaseFont.CreateFont(BaseFont.HELVETICA, >>> BaseFont.WINANSI, >>> pdfAcompliant);
Please read the documentation on iText. pdfAcompliant is IGNORED when you are using one of the Base14 fonts WITHOUT providing a font program. In other words: you are NOT embedding the font. -- This answer is provided by 1T3XT BVBA http://www.1t3xt.com/ - http://www.1t3xt.info ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://www.1t3xt.com/docs/book.php
