Hi everyone,
I have developed a complete erp software with xojo.
I’m wondering why i have diffenrences in my invoice forms between the printed version, or displayed version and my pdf-file of the invoice. The first example is the pdf, the second one the printing/screen.
As you can see in my screenshots there is a problem in the pdf when i’m right-aligning text.
I think it has to do with the textwidth of the string which i’m using for this alignment. I know that I also have to take the resolution into account, but I generally do that too. But if I now multiply the textwidth by my factor, I get completely wrong results.
Here is an extract of my code for this part of the invoice-form:
strT=dTranslate.lookup(“zzglUst”,“zzgl. Umsatzsteuer”)+" “+Format(currv.ustsatz3,”#0.0")+“% “+dtranslate.Lookup(“Ustauf”,“auf”)+” “+Format(currv.artikelnetto3-RabattNetto3+currV.VersandkostenNet3,”-###,###,##0.00”)+waehrIcon+": "
var tW as Single=g.TextWidth(strT)
g.DrawText(strT,spX6+spW6-g.TextWidth(strT),ypos)
SpX6 and spW6 are the position of the column and the width of the column where i position this text.
Hi Emile, thanks for the reply and sorry, the variable tW was only used by me for checking the calculated value of Textwidth. Of course it doesn’t make a sense to declare tW and than not using it…
I have to open this post again, unforunately the textwidth is still different and the right-aligned-text will not be displayed correctly in the pdf, although i’m using embeddedfonts and a PDFDocument.StandardfontName.
I’m not sure, but my suspicion is that the text width is calculated differently. I need this value for the right alignment of the text.
Yes, you need to set the font (name, size, styles…) before printing anything, before asking for a string length (of course)… else the value will be wrong.