If you want to do all by yourself look at the code that I pointed to, all the
transformations are there. If you want to let iText do the work for you use
ColumnText.ShowTextAligned(), it supports PdfContentByte, and use a Font with a
Font.ITALIC style, and the slanting will be done for free.
Paulo
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
> Behalf Of irashkin
> Sent: Wednesday, September 17, 2008 4:32 PM
> To: [email protected]
> Subject: Re: [iText-questions] pseudo-italic (transform)
> causing horizontal offset
>
>
> I also need PDFContentByte writing because I have to have absolute
> positioning for every element.
>
> irashkin wrote:
> >
> > Thanks for the quick reply! I didn't think I was able to
> use chunks with
> > PDfContentByte directly. Is that true? I have to use
> PDFContentByte (I am
> > pretty sure anyway...) because of a bunch of other graphic
> things I am
> > doing.
> >
> >
> >
> > Paulo Soares-3 wrote:
> >>
> >> Look for Chunk.SKEW in PdfDocument.WriteLineToContent().
> >>
> >> Paulo
> >>
> >>> -----Original Message-----
> >>> From: [EMAIL PROTECTED]
> >>> [mailto:[EMAIL PROTECTED] On
> >>> Behalf Of irashkin
> >>> Sent: Wednesday, September 17, 2008 3:20 PM
> >>> To: [email protected]
> >>> Subject: [iText-questions] pseudo-italic (transform) causing
> >>> horizontal offset
> >>>
> >>>
> >>> Hi,
> >>> I am actually using iTextSharp, but I don't know if this
> >>> problem is specific
> >>> to iTextSharp or is a general problem (or misunderstanding by
> >>> me) of iText.
> >>> I am working with some embedded fonts that don't have italic
> >>> options. So, to
> >>> get around this, I am doing a skew transformation, and the
> >>> italicization
> >>> looks ok. But it is offsetting the x value as well, even
> >>> though I am passing
> >>> 0 for x and y (e and f) values in my matrix.
> >>> In other words, I am doing something like this:
> >>>
> >>> float x = 28F;
> >>> float y = 100F;
> >>> float italicization = xFontSize / 100F;
> >>> Matrix m = new Matrix(1F, 0F, italicization, 1F, 0F, 0F);
> >>> cb.Transform(m);
> >>> cb.ShowTextAligned(0, Content[i].Trim(), x, y, 0F);
> >>> m = new Matrix(1F, 0F, 0F-italicization, 1F, 0F, 0F);
> >>> cb.Transform(m);
> >>> cb.ShowTextAligned(0, Content[i].Trim(), x, y, 0F);
> >>>
> >>> so, first I write the string (Content[i]) in pseudo-italics,
> >>> then transform
> >>> back to original and write it un0-italicized for comparison.
> >>> The offset varies, but depending (I think) on font size and
> >>> maybe also on
> >>> string length, the offset is by 2 to 6 characters.
> >>>
> >>> I have been trying many combinations of italicization values,
> >>> offsetting x
> >>> by variable amounts, and so on, but I can't get this to come
> >>> out right.
> >>> I also tried this but it does exactly the same thing.:
> >>>
> >>> Matrix m = new Matrix(1F, 0F, italicization, 1F, x, 0F);
> >>> cb.Transform(m);
> >>> cb.ShowTextAligned(iAlign, Content[i].Trim(), 0F, y, 0F);
> >>> m = new Matrix(1F, 0F, 0F-italicization, 1F, 0F-x, 0F);
> >>> cb.Transform(m);
> >>> cb.ShowTextAligned(iAlign, Content[i].Trim(), x, y, 0F);
> >>>
> >>>
> >>> Interstingly,m I had this working, sort of - I was just
> doing this:
> >>>
> >>> cb.ConcatCTM(1F, 0F, italicization, 1F, 0F, 0F);
> >>> cb.SaveState();
> >>> cb.ShowTextAligned(0, Content[i].Trim(), x, y, 0F);
> >>> cb.RestoreState();
> >>>
> >>> and this was giving me good results, but was then causing
> a PDf error:
> >>> Illegal operation 'Q' inside a text object. (this all
> happens inside a
> >>> beginText()-endText() block, which I guess is not ok).
> >>>
> >>> Does anyone have any ideas about this? I am going crazy. I
> >>> can give you more
> >>> info as needed - I tried to give enough, but maybe not...
> >>>
> >>> Thanks,
> >>> Ian
Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter
informação confidencial ou legalmente protegida. A incorrecta transmissão desta
mensagem não significa a perca de confidencialidade. Se esta mensagem for
recebida por engano, por favor envie-a de volta para o remetente e apague-a do
seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de
usar, revelar ou distribuir qualquer parte desta mensagem.
Disclaimer:
This message is destined exclusively to the intended receiver. It may contain
confidential or legally protected information. The incorrect transmission of
this message does not mean the loss of its confidentiality. If this message is
received by mistake, please send it back to the sender and delete it from your
system immediately. It is forbidden to any person who is not the intended
receiver to use, distribute or copy any part of this message.
-------------------------------------------------------------------------
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