riadvice / AlivePDF

[Official AlivePDF] - AlivePDF is a client side AS3 PDF generation library for Adobe Flash, Flex and AIR
https://riadvice.github.io/AlivePDF/
32 stars 6 forks source link

addMultiCell and Center Alignment #67

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I am trying to add a multicell with the text centered but for some reason
when I call the function with the centered argument it wont display the text.

myPDFEncoder.setFont(FontFamily.TIMES, Style.NORMAL, 12);
    myPDFEncoder.textStyle ( new RGBColor ( 0x000000 ) );
    myPDFEncoder.beginFill(new RGBColor (0x999999));
    var prj:String='Project Number: '+ '08-0000-000';
    myPDFEncoder.setXY(425,200);
    myPDFEncoder.addMultiCell(165,22,prj,0,'C',1);

It will only display the area of the cell since I have the fill turned on.
 If I leave the argument out or put 'J' in the text is displayed fine.

Original issue reported on code.google.com by smiling...@gmail.com on 9 Jul 2008 at 9:42

GoogleCodeExporter commented 8 years ago
I had the same problem but I found the solution :

You have to replace 

cwAux += cw[content.charAt(l)] as Number;

by

cwAux = cw[content.charAt(l)] as Number;

on line 2878 in PDF.as

Original comment by couac...@gmail.com on 10 Jul 2008 at 1:17

GoogleCodeExporter commented 8 years ago
How do I do that if I am using the swc?

Original comment by smiling...@gmail.com on 10 Jul 2008 at 3:40

GoogleCodeExporter commented 8 years ago
Nevermind, I replaced the SWC with the source .as files and made the change and 
it
still is doing the same thing.

Original comment by smiling...@gmail.com on 10 Jul 2008 at 3:54

GoogleCodeExporter commented 8 years ago
Hi guys,

Interesting, I will take a look at it and fix that for the next release.
Thanks for tracking.

cheers,

Thibault

Original comment by thibault.imbert on 17 Jul 2008 at 5:35

GoogleCodeExporter commented 8 years ago
The problem is in the getStringWidth function. The variable "w" is accumulating 
the
cwAux value with each iteration. Problem was solved when I commented (as shown) 
and
made assignment after loop.  

                if ( isNaN ( cwAux ) ) cwAux = 580;

                //w += cwAux;

            }

            w=cwAux;

            return w*fontSize/1000;

        }

Original comment by Troy.hof...@pearson.com on 28 Jul 2008 at 6:15

GoogleCodeExporter commented 8 years ago
Thank you guys, I added this fix in the next release.

Thanks for tracking ;)

Thibault

Original comment by thibault.imbert on 26 Sep 2008 at 10:16