Comments (4)
I found what the problem looks at the function where accumulates "l" and
commented
code, and I am now working properly.
public function writeText ( pHeight:Number, pText:String, pLink:String='' ):void
{
//Output text in flowing mode
var cw:Object = this.currentFont.cw;
var w:Number = currentPage.w-this.rMargin-this.x;
var wmax:Number = (w-2*this.cMargin)*1000/this.fontSize;
var s:String = str_replace ("\r",'',pText);
var cwAux:int = 0;
//var s:String = ",,,"
var nb:int = s.length;
var sep:int = -1;
var i:int = 0;
var j:int = 0;
var l:int = 0;
var nl:int = 1;
while( i<nb )
{
//Get next character
var c:String = s.charAt(i);
if(c=="\n")
{
//Explicit line break
this.addCell (w,pHeight,s.substr(j,i-j),0,2,'',0,pLink);
i++;
sep=-1;
j=i;
l=0;
if(nl==1)
{
this.x = this.lMargin;
w = currentPage.w-this.rMargin-this.x;
wmax= (w-2*this.cMargin)*1000/this.fontSize;
}
nl++;
continue;
}
if(c==' ') sep=i;
/*
Here verify if the character is unknown I value 500 by default, because the
problem is that if the character is not in the array can not add accumulator
"l".
Notice whether this solution is valid. Thanks
*/
cwAux = int(cw[c]);
if (cwAux == 0)
{
cwAux = 500;
}
l+=cwAux;
if(l>wmax)
{
//Automatic line break
if(sep==-1)
{
if(this.x>this.lMargin)
{
//Move to next line
this.x = this.lMargin;
this.y += currentPage.h;
w = currentPage.w-this.rMargin-this.x;
wmax = (w-2*this.cMargin)*1000/this.fontSize;
i++;
nl++;
continue;
}
if(i==j) i++;
this.addCell (w,pHeight,s.substr(j,i-j),0,2,'',0,pLink);
}
else
{
this.addCell (w,pHeight,s.substr(j,sep-j),0,2,'',0,pLink);
i=sep+1;
}
sep=-1;
j=i;
l=0;
if(nl==1)
{
this.x=this.lMargin;
w=currentPage.w-this.rMargin-this.x;
wmax=(w-2*this.cMargin)*1000/this.fontSize;
}
nl++;
}
else i++;
}
//Last chunk
if (i!=j) this.addCell (l/1000*this.fontSize,pHeight,s.substr(j),0,0,'',0,pLink);
}
Original comment by [email protected]
on 13 Nov 2007 at 3:31
from alivepdf.
We must correct the following function to operate the 'link' correct:
private function GetStringWidth(s:String):Number
{
var s:String = String ( s );
cw = currentFont.cw
var w:Number=0;
var l:int = s.length;
var cwAux:Number = 0;
for(var i:int=0;i<l;i++)
{
cwAux = Number(cw[s.charAt(i)]);
if (isNaN(cwAux))
{
cwAux = 500;
}
w+= cwAux;
}
return w*fontSize/1000;
}
Original comment by [email protected]
on 13 Nov 2007 at 4:17
from alivepdf.
Hi castromatias,
Thanks for tracking, I will include that and also optimize some other things
related
to special characters in the next version ;)
kind regards,
Thibault
Original comment by thibault.imbert
on 13 Nov 2007 at 6:46
from alivepdf.
Hi, I'm trying to write text (using writeText function) with special spanish
characters (same as castromatias) from an utf-8 xml but I always get wrong
results:
Ä, Â, etc... followed by another character.
I changed /WinAnsiEncoding encoding to all the posibilities (i think) but the
result
is the same.
When I debug code I see correct characters in Flex but when pdf is generated
everyone
turns wrong.
Thanks,
Fer
Original comment by [email protected]
on 3 Apr 2008 at 9:41
from alivepdf.
Related Issues (20)
- ASDoc error
- writeHtmlText + addMulticell
- addBookmark supports only eight colors
- Can't override header or footer method HOT 1
- how can i open Local drive pdf file through AS3?
- Adding multiple image freeze the ui
- Grid problem
- addImage with displayObjects is not working
- AlivePDF does not print content of Flash Pro CS5.5 Stage
- AddImage() problem HOT 1
- Security error #3769 breaks navigateToUrl() while trying to save PDF HOT 5
- savePDF() method HOT 1
- problems with mx cavas scaled on add image
- Chinese characters won't show on iOS
- PNG error "Missing palette in current picture" HOT 1
- Some addGrid bugs HOT 1
- .. HOT 1
- setAutoPageBreak(true) does not restore margin HOT 1
- Problems exporting IPA with AIR SDK 15 & especially 16 in Flash Builder
- AlivePDF Page elements are messed up with AIR SDK 16+
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from alivepdf.