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

Various Issues with UnicodePDF + ArialUnicodeMS + Kanji #256

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

try to create pdf with UnicodePDF in an AIR application with Kanji text (or mix 
of Kanji and English) via addText, writeText or addCell with following code:

private function createPDF():void
{
var p:UnicodePDF=new UnicodePDF(Orientation.PORTRAIT,Unit.MM,true,Size.A4);         
p.addPage();
p.setFont( new ArialUnicodeMS(CidInfo.JAPANESE), 14 );          
p.textStyle( new RGBColor(0x990000), 1 );
var msg:String = "価値計算ツール";
//p.addText( msg, 50, 50 );
//p.writeText(27, msg);
p.addCell(175,20,msg,0,1,'L',0);

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

What is the expected output? What do you see instead?

There seems to be several issues:

1) Wrong Characters. 
For the code above, instead of "価値計算ツール", 
the pdf displays "価値詜扻霰".

2) English Converted to Kanji. 
If I change the msg var to "English 価値計算ツール",
the pdf displays "English 価値詜扻霰", however, 
if I change the msg var to "価値計算ツール English", 
the pdf displays "価値詜扻霰    渀最 椀"

3)Acrobat Error.
If I change the msg var to "English 123 価値計算ツール",
the pdf displays "English 123 価値詜扻霰"
and I get the Acrobat error 'An error exists on this page.Acrobat may not 
display the page correctly.Please contact the person..." 

What version of the product are you using? On what operating system?
Windows 7, AlivePDF 1.5 rev 273

Please provide any additional information below.

I conducted these desktop tests as an exploration into why my attempts at 
utilizing UnicodePDF+ArialUnicodeMS+Kanji in a web based application were not 
working. My web version simply displays an empty page. The Acrobat toolbar 
flashes for split second, but disappears and the window is blank. In my web 
version I am passing the data to the Alive create.php script. Has this script 
been updated since the implementation of UnicodePDF? I have not yet 
experimented with the FlashPlayer 10 client side file saving feature. The new 
feature may eliminate the need for hitting create.php and that may get me past 
my blank page issue, but I fear all the same issues outlined above will still 
be present.

I have read and re-read all of the related posts and tried any work around I 
could find. Most, if not all, of the work-arounds I've seen seem to have been 
implemented into AlivePDF, so I am at a loss for what else to do.

Thank you for any insight or advice,
Chris

Original issue reported on code.google.com by chris.fa...@gmail.com on 30 Jun 2010 at 7:56