sivarajankumar / alivepdf

Automatically exported from code.google.com/p/alivepdf
0 stars 0 forks source link

getStringWidth calculates the width of a string incorrectly. #83

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use any method that uses the private getStringWidth function (addCell, 
addMultiCell) to center or right align text.
2. See that alignment is off.

What is the expected output? What do you see instead?
Alignment should be centered but is instead justified more to the left.

What version of the product are you using? On what operating system?
0.1.4.4

Please provide any additional information below.
I have a fix for this problem.

On line 2927 of PDF.as change the following line from:

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

to

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

This seems to correct the issue.

I also would like to suggest making this method public to assist in manual 
alignment of strings.

Original issue reported on code.google.com by korewana...@gmail.com on 23 Sep 2008 at 6:00

GoogleCodeExporter commented 8 years ago
Korewananda, thanks much, it's wery hope to me in my case

Original comment by yaroslav...@gmail.com on 29 Sep 2008 at 2:47

GoogleCodeExporter commented 8 years ago
Hi guys,

Thanks for tracking this bug.

The new version 0.1.4.6 is fixing this bug :)

Thibault

Original comment by thibault.imbert on 29 Sep 2008 at 9:23

GoogleCodeExporter commented 8 years ago
Hi,

I have been trying to centre align the text in a MultiCell and it wont actually
centre correctly, it seems that the problem is that the text isnt wrapping 
correctly
and some text is actually outside the right of the multicell?

take a look at the attached PDF.

Great work on alivePDF!

Original comment by mike_sow...@hotmail.com on 16 Apr 2009 at 3:00

Attachments:

GoogleCodeExporter commented 8 years ago
It would still be nice if the method was public, hope that's in the pipeline. 
Thanks.

Original comment by tris...@gmail.com on 6 Nov 2009 at 12:03