wiln / alivepdf

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

Grid disappearing when used with UnicodePDF, mixed characters #268

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use UnicodePDF:

p = new UnicodePDF( Orientation.PORTRAIT, Unit.MM, true, Size.A4 );

p.addPage();
p.setFont(new ArialUnicodeMS(CidInfo.CHINESE_SIMPLIFIED), 14 );
p.textStyle( new RGBColor(0X000000), 1 );

2. Set up a grid:

var gridColumnCategory:GridColumn = new GridColumn(
"加载数",                                    "Name",                                 120,
Align.LEFT,
Align.LEFT);

var grid:Grid = new Grid (sampleData.source,
                190,
                500,
                new RGBColor (0xCCCCCC));            
grid.columns = [gridColumnCategory];
p.addGrid( grid, 0, 0);

3. Use data that has both Western and non-Western characters (seems like there 
has to be a certain amount of data, the following example causes the issue):

[Bindable] private var sampleData:ArrayCollection = new ArrayCollection( [
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "加载导航数"},
    { Name: "asdf"},
    { Name: "asdf"},
    { Name: "asdf"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "asdf"},
    { Name: "asdf"},
    { Name: "asdf"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"},
    { Name: "asdf"},
    { Name: "asdf"},
    { Name: "Asdf aaaa aaaaaaaaaa aaaaaa aa"}]);

What is the expected output? What do you see instead?
Expected output is to see the grid rendered with no errors, instead I see the 
grid when I first load the PDF, but if I resize the PDF or go to another page, 
the part of the grid rendered on the first page disappears.

What version of the product are you using? On what operating system?
I'm using the latest source from svn for 1.5.0. This is on WinXP.

Please provide any additional information below.
The issue doesn't seem to occur if the data grid doesn't break across pages, 
also modifying the strings in the data seems to have an effect, but it's 
unclear what kinds of strings cause the issue apart from the mix of Western and 
non-Western.

Attaching a simple test case and a sample of the PDF that results.

Original issue reported on code.google.com by jlamo...@gmail.com on 7 Aug 2010 at 2:04

Attachments:

GoogleCodeExporter commented 9 years ago
I was able to make this issue go away by commenting out the following line in 
the fromCharCode method in UnicodePDF:

protected function fromCharCode(code:uint):String
{
// if(code == 0) return "\xFE\xFF"; //return double byte order mark, later to 
be replaced with 0
return String.fromCharCode(code);

Without seeming to cause any bad side effects (the sample PDF and others 
generate properly with no issues), but I'm unclear as to what this fixed as 
well as if there might be some problems that come up as a result.  

Original comment by jlamo...@gmail.com on 13 Aug 2010 at 7:06

GoogleCodeExporter commented 9 years ago
Many thanks for posting the issue with details. I am also having similar 
problem in displaying the chinese and english from page 2.

Please post the solution.

Thanks,
Ravichandran

Original comment by ravichandran96@gmail.com on 6 Sep 2011 at 3:53

GoogleCodeExporter commented 9 years ago
I used SVN rev 273 of AlivePDFBeta in trunk... and just made that single change 
to UnicodePDF mentioned above to make the issue go away for me.  I haven't run 
into any adverse side effects.

Original comment by jlamo...@gmail.com on 7 Sep 2011 at 8:39