Hi,

Yeah I see what you mean, however this is the use case: (pseudo code)

Class point
{
        double x;
        double y;
};

Foreach point p in points
{
        Pcb.LineTo((float)p.x,(float)p.y);
}

When working with very fine detail and accuracy we need to keep the precision.

So basically the issue is iTextSharp does not have overloaded MoveTo/LineTo etc 
methods that take doubles, *forcing* us to cast to floats, thus loosing 
precision.

Hope this makes sense.

Thanks
Mark






-----Original Message-----
From: iText Info [mailto:i...@1t3xt.info] 
Sent: 08 August 2013 12:13
To: itext-questions@lists.sourceforge.net
Subject: Re: [iText-questions] Precision Fix

Op 8/08/2013 11:42, Mark Duffill schreef:
>
> Hi,
>
> We are using iTextSharp to write out pdfs, however there was an issue 
> with precision.
>
> We enabled ByteBuffer.HIGH_PRECISION, but also needed to make the 
> following code change to PdfContentBytes.cs
>
> (Basically so we can pass in double precision values).
>

I don't know about iTextSharp, but in iText, the casting is done in the 
ByteBuffer class:

     /**
      * Appends a string representation of a <CODE>float</CODE> according
      * to the Pdf conventions.
      * @param i the <CODE>float</CODE> to be appended
      * @return a reference to this <CODE>ByteBuffer</CODE> object
      */
     public ByteBuffer append(float i) {
         return append((double)i);
     }

This makes your fix unnecessary, doesn't it? I see that the same happens in 
iTextSharp:

        /**
          * Appends a string representation of a <CODE>float</CODE> according
          * to the Pdf conventions.
          * @param i the <CODE>float</CODE> to be appended
          * @return a reference to this <CODE>ByteBuffer</CODE> object
          */
         public ByteBuffer Append(float i) {
             return Append((double)i);
         }

Why would we need to cast the float value to double values in each drawing 
function if the casting is done in ByteBuffer?

Please explain.

------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to