kpuchalski / alivepdf

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

Grid headers appear twice & some Chinese characters become irrecognizable #296

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. using code following:
private var dp:ArrayCollection=new ArrayCollection();

dp.addItem( { 姓名 : "张三",  邮箱 : "zhangsan@adobe.com", 
城市:"北京"});
dp.addItem( { 姓名 : "李四", 邮箱 : "lx@adobe.com", 城市 : "上海" } );
dp.addItem( { 姓名 : "XYZ",  邮箱 : "xyz@adobe.com", 城市 : "ABC" } );

var p:PDF = new UnicodePDF(Orientation.PORTRAIT,Unit.MM,false);
p.addPage();
p.setFont( new ArialUnicodeMS(CidInfo.CHINESE_SIMPLIFIED) );
p.textStyle(new RGBColor(0x000000));

var columns:Array=[];
var gridColumnName:GridColumn = new GridColumn("姓名", "姓名", 45, 
Align.LEFT, Align.LEFT);
columns.push(gridColumnName);
var gridColumnEmail:GridColumn = new GridColumn("邮箱", "邮箱", 40, 
Align.LEFT, Align.LEFT);
columns.push(gridColumnEmail);
var gridColumnCity:GridColumn = new GridColumn("城市", "城市", 30, 
Align.LEFT, Align.LEFT);
columns.push(gridColumnCity);

var grid:Grid = new Grid( dp.toArray(), 30, 15, new RGBColor(0xcccccc),new 
RGBColor(0xcccccc),true,new RGBColor(0x887711),new 
RGBColor(0x666666),1,5,5,Joint.ROUND,columns);          

p.addGrid( grid );

var f:FileStream = new FileStream();
file = File.desktopDirectory.resolvePath("test.pdf");
f.open( file, FileMode.WRITE);
var bytes:ByteArray = p.save( Method.LOCAL );
f.writeBytes(bytes);
f.close();

2. The outcome is shown in the file attach.

What is the expected output? What do you see instead?
The characters should be recognizable and there the headers should be shown 
only once.

What version of the product are you using? On what operating system?
Debian testing,  get it via svn while using 1.5.0RC get no recognizable Chinese 
characters.

Please provide any additional information below.

Original issue reported on code.google.com by jeff_j...@126.com on 17 Jan 2011 at 8:20

Attachments:

GoogleCodeExporter commented 9 years ago
I solved them all.

1. Comment the 3 lines below in function addGrid() of PDF.as:
setXY (x +currentGrid.x, y+getY() );
addRow( columnNames,'', rect);
endFill();

2. Change function excapeIt() from PDF.as as:

protected function escapeIt(content:String):String
{
    content = findAndReplace('\\','\\\\',content);
    content = findAndReplace('\n', "\\n",content);
    content = findAndReplace('\r', "\\r",content);
    content = findAndReplace('\t', "\\t",content);
    content = findAndReplace('\b', "\\b",content);
    content = findAndReplace('\f', "\\f",content);
    //return findAndReplace(')','\\)',findAndReplace('(','\\(',findAndReplace('\\','\\\\',content))); 
    return findAndReplace(')','\\)',findAndReplace('(','\\(',content));
} 

Original comment by jeff_j...@126.com on 21 Jan 2011 at 3:31

GoogleCodeExporter commented 9 years ago
Part 1 of the issue (duplicate header) has been fixed.

Original comment by cgauth...@gmail.com on 28 Feb 2015 at 12:21