Back to Blog

    Developer Blog

    Controlling the precision of numeric values in PDF files

    Foxit Quick PDF Library

    Foxit Quick PDF Library includes a function called SetPrecision which allows you to control the precision of numeric values in PDF files.

    In a PDF all numeric values are stored as strings. So using a smaller precision would mean a number takes up less characters in the file.

    If a PDF has a lot of complex graphics this would add up cumulatively and reduce the total file size.

    The default precision is 4 and measurement units are points (1/72 inch), so the smallest measurement with the default precision is 0.000001 inch.

    Dropping the precision to 2 would result in the smallest measurement being 0.0001 inch.
    For most purposes a 0.0001 inch precision would be good enough – but some things might not align perfectly.

    The maths for the precision calculations in inches are (1/10000 * 1/72) for the precision of 4, and (1/100 * 1/72) for the precision of 2.

    This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.