|
PDF real numbers out of range
Message-ID:<24080da6-8650-4ff4-9069-ffbb0fc8c260@q14g2000vbi.googlegroups.com>
Subject:PDF real numbers out of range
Date:Fri, 18 Sep 2009 20:30:17 +0100
We have a situation where PostScript code such as "0 -72790 M ", when
passed through Adobe Distiller, creates (I am told) a PDF command of
this sort: "-79378.9219 -7519.9844 TD".
Our user is trying to create a PDF archive in conformance with PDF/
A-1a. That is based on PDF 1.4, in which the limit for a real number
value is +- 32,767.
The limit for a real number value in PostScript is +- 10 to the 38th.
Both PS and PDF allow *integers* in the range +- 2 billion and
change. Why the limit on reals in PDF?
Also, why does Distiller use reals when we input integers?
Background: for reasons lost in typographic history, we translate the
origin to the upper left and thus place items downward with negative Y
position. We also scale the page to 25,400 units per inch rather than
the PS default of 72 units per inch. So our move is only about three
inches down the page, and the zero X position is lined up with some
visible text at 0,-69150, about which we get no complaints,
apparently.
The PostScript views normally in ghostscript and the PDF views
normally in Adobe Reader.
It looks to me like Adobe Distiller is mucking up the numbers by
either not handling the scaling right or using real numbers when
integers ought to be used -- although I don't really know what
"-79378.9219 -7519.9844 TD" does.
-Mark DeVries
SDL XySoft
Message-ID:<MPG.251ee5b34e4d014198979f@usenet.plus.net>
Subject:Re: PDF real numbers out of range
Date:Sat, 19 Sep 2009 13:58:21 +0100
In article <24080da6-8650-4ff4-9069-ffbb0fc8c260
@q14g2000vbi.googlegroups.com>, devries@xyenterprise.com says...
> We have a situation where PostScript code such as "0 -72790 M ",
PostScript doesn't have an 'M' operator, so this must be a procedure
defined in the PostScript prolog. Its 'probably' the same as the PDF M
operator which means 'moveto'
> passed through Adobe Distiller, creates (I am told) a PDF command of
> this sort: "-79378.9219 -7519.9844 TD".
TD is a PDF text opertor, it meams 'move to the start of the next line,
offset by the supplied parameters'. Sort of similar to the probable
PostScript 'moveto' if the moveto were followed by a text operation.
> Our user is trying to create a PDF archive in conformance with PDF/
> A-1a. That is based on PDF 1.4, in which the limit for a real number
> value is +- 32,767.
> The limit for a real number value in PostScript is +- 10 to the 38th.
> Both PS and PDF allow *integers* in the range +- 2 billion and
> change. Why the limit on reals in PDF?
That limit is not present in later versions of PDF which allow the same
range of values for reals as PostScript, ie +/-3.403 x 10^38. However
earlier versions of PDF did place significant limits on real numbers.
The spec does not say but I assume that these versions of Acrobat used a
fixed precision representation for real numbers, with a sign bit, 15 bit
integer and 16 bit fractional representation. Thus leading to a +/-
32,767 value.
Note that this was an implementation limit in Acrobat, but the ISO
adopted it as part of the specification for PDF/A. So this is an old
architectural limitation adopted by the spec to assure relilable reading
of the documents.
> Also, why does Distiller use reals when we input integers?
Because the operator is almost certainly calculated using the text
matrix. The text matrix values will be real numbers and there will be
some inaccuracy (remember that 0 cannot be precisely represented in the
IEE single precision representation).
So when you calculate the text leading using the text matrix you end up
with something which is not the same as you started with.
All PostScript to PDF producers do something like this.
> Background: for reasons lost in typographic history, we translate the
> origin to the upper left and thus place items downward with negative Y
> position. We also scale the page to 25,400 units per inch rather than
> the PS default of 72 units per inch. So our move is only about three
> inches down the page, and the zero X position is lined up with some
> visible text at 0,-69150, about which we get no complaints,
> apparently.
Well, that's where your problem arises. Your scale factor is applied to
the CTM which is concatenated with the text matrix to calculate
positions. If you insist on using such a large scale factor in user
space then you will end up with large real numbers.
> The PostScript views normally in ghostscript and the PDF views
> normally in Adobe Reader.
The values are permissible in PostScript, so GS will work with the
PostScript. The real number representation is permissible in later
versions of Acrobat. To prove this, try opening the file in Acrobat
Reader 5 (which only supports PDF 1.4).
> It looks to me like Adobe Distiller is mucking up the numbers by
> either not handling the scaling right or using real numbers when
> integers ought to be used -- although I don't really know what
> "-79378.9219 -7519.9844 TD" does.
Without seeing the job (PS and PDF) I can't really be sure, but I
suspect you have simply overflowed the fixed precision representation.
This 'ought' ideally to produce an error if you are creating PDF/A
files, but spotting arithemetic overflows (especially only under certain
conditions) would probably make the interpretation process painfully
slow.
If you want to produce a PDF/A compliant file you will need to find some
way to make those numbers smaller. The only suggestion I can make is not
to scale user space by enormous numbers.
Ken
Message-ID:<c0ea544a-d1e7-4110-82b8-f2f3072bf1ec@12g2000pri.googlegroups.com>
Subject:Re: PDF real numbers out of range
Date:Mon, 26 Oct 2009 03:56:30 +0100
On Sep 21, 2:34=A0pm, xymarkd <devr...@xyenterprise.com> wrote:
> Ken,
>
> Thanks for your thorough response. =A0I promise not to shoot the
> messenger. =A0:-)
>
> -Mark
>
> On Sep 19, 8:58=A0am, ken <k...@spamcop.net> wrote:
>
> > In article <24080da6-8650-4ff4-9069-ffbb0fc8c260
> > @q14g2000vbi.googlegroups.com>, devr...@xyenterprise.com says...
>
> > > We have a situation where PostScript code such as "0 -72790 M ",
>
> > PostScript doesn't have an 'M' operator, so this must be a procedure
> > defined in the PostScript prolog. Its 'probably' the same as the PDF M
> > operator which means 'moveto'
>
> > > passed through Adobe Distiller, creates (I am told) a PDF command of
> > > this sort: "-79378.9219 -7519.9844 TD".
>
> > TD is a PDF text opertor, it meams 'move to the start of the next line,
> > offset by the supplied parameters'. Sort of similar to the probable
> > PostScript 'moveto' if the moveto were followed by a text operation.
>
> > > Our user is trying to create a PDF archive in conformance with PDF/
> > > A-1a. =A0That is based on PDF 1.4, in which the limit for a real numb=
er
> > > value is +- 32,767.
> > > The limit for a real number value in PostScript is +- 10 to the 38th.
> > > Both PS and PDF allow *integers* in the range +- 2 billion and
> > > change. =A0Why the limit on reals in PDF?
>
> > That limit is not present in later versions of PDF which allow the same
> > range of values for reals as PostScript, ie +/-3.403 x 10^38. However
> > earlier versions of PDF did place significant limits on real numbers.
> > The spec does not say but I assume that these versions of Acrobat used =
a
> > fixed precision representation for real numbers, with a sign bit, 15 bi=
t
> > integer and 16 bit fractional representation. Thus leading to a +/-
> > 32,767 value.
>
> > Note that this was an implementation limit in Acrobat, but the ISO
> > adopted it as part of the specification for PDF/A. So this is an old
> > architectural limitation adopted by the spec to assure relilable readin=
g
> > of the documents.
>
> > > Also, why does Distiller use reals when we input integers?
>
> > Because the operator is almost certainly calculated using the text
> > matrix. The text matrix values will be real numbers and there will be
> > some inaccuracy (remember that 0 cannot be precisely represented in the
> > IEE single precision representation).
>
> > So when you calculate the text leading using the text matrix you end up
> > with something which is not the same as you started with.
>
> > All PostScript to PDF producers do something like this.
>
> > > Background: for reasons lost in typographic history, we translate the
> > > origin to the upper left and thus place items downward with negative =
Y
> > > position. =A0We also scale the page to 25,400 units per inch rather t=
han
> > > the PS default of 72 units per inch. =A0So our move is only about thr=
ee
> > > inches down the page, and the zero X position is lined up with some
> > > visible text at 0,-69150, about which we get no complaints,
> > > apparently.
>
> > Well, that's where your problem arises. Your scale factor is applied to
> > the CTM which is concatenated with the text matrix to calculate
> > positions. If you insist on using such a large scale factor in user
> > space then you will end up with large real numbers.
>
> > > The PostScript views normally in ghostscript and the PDF views
> > > normally in Adobe Reader.
>
> > The values are permissible in PostScript, so GS will work with the
> > PostScript. The real number representation is permissible in later
> > versions of Acrobat. To prove this, try opening the file in Acrobat
> > Reader 5 (which only supports PDF 1.4).
>
> > > It looks to me like Adobe Distiller is mucking up the numbers by
> > > either not handling the scaling right or using real numbers when
> > > integers ought to be used -- although I don't really know what
> > > "-79378.9219 -7519.9844 TD" does.
>
> > Without seeing the job (PS and PDF) I can't really be sure, but I
> > suspect you have simply overflowed the fixed precision representation.
> > This 'ought' ideally to produce an error if you are creating PDF/A
> > files, but spotting arithemetic overflows (especially only under certai=
n
> > conditions) would probably make the interpretation process painfully
> > slow.
>
> > If you want to produce a PDF/A compliant file you will need to find som=
e
> > way to make those numbers smaller. The only suggestion I can make is no=
t
> > to scale user space by enormous numbers.
>
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Ken
</rdf:li>Ken
>>
</rdf:Alt>
</Map:Thumbnails>
</rdf:Description>
<rdf:Description rdf:about=3D""
Mmlns:MapMM=3D"http://ns.adobe.com/Map/1.0/mm/"
Mmlns:stRef=3D"http://ns.adobe.com/Map/1.0/sType/
ResourceRef#"
Mmlns:stMfs=3D"http://ns.adobe.com/Map/1.0/sType/
ManifestItem#">
<MapMM:DocumentID>uuid:0B52FECF2CCE11DE91F7C0764D4862B8</
MapMM:DocumentID>
<MapMM:InstanceID>uuid:ddde0ee8-a759-4596-abde-0c29d8b3434c</
MapMM:InstanceID>
<MapMM:DerivedFrom rdf:parseType=3D"Resource">
<stRef:instanceID>uuid:0B52FECE2CCE11DE91F7C0764D4862B8</
stRef:instanceID>
<stRef:documentID>uuid:891D2D252B5711DEBB1FEA034BD9AE77</
stRef:documentID>
</MapMM:DerivedFrom>
<MapMM:Manifest>
<rdf:Seq>
<rdf:li rdf:parseType=3D"Resource">
<stMfs:linkForm>EmbedByReference</stMfs:linkForm>
<stMfs:reference rdf:parseType=3D"Resource">
<stRef:filePath>/Users/may/Desktop/JOBS M JOBS/B/
BAIDURI BANK/Baiduri Golf Masters 09/CM09N01IM0003.tif</
stRef:filePath>
</stMfs:reference>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stMfs:linkForm>EmbedByReference</stMfs:linkForm>
<stMfs:reference rdf:parseType=3D"Resource">
<stRef:filePath>/Users/may/Desktop/JOBS M JOBS/B/
BAIDURI BANK/Baiduri Golf Masters 09/E90 Pre LCI_1.jpg</
stRef:filePath>
</stMfs:reference>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stMfs:linkForm>EmbedByReference</stMfs:linkForm>
<stMfs:reference rdf:parseType=3D"Resource">
<stRef:filePath>/Users/may/Desktop/JOBS M JOBS/B/
BAIDURI BANK/Baiduri Golf Masters 09/M3_M3_11.jpg</stRef:filePath>
</stMfs:reference>
</rdf:li>
</rdf:Seq>
</MapMM:Manifest>
</rdf:Description>
<rdf:Description rdf:about=3D""
Mmlns:illustrator=3D"http://ns.adobe.com/illustrator/1.0/">
<illustrator:StartupProfile>Print</
illustrator:StartupProfile>
</rdf:Description>
<rdf:Description rdf:about=3D""
Mmlns:MapTPg=3D"http://ns.adobe.com/Map/1.0/t/pg/"
Mmlns:stDim=3D"http://ns.adobe.com/Map/1.0/sType/
Dimensions#"
Mmlns:stFnt=3D"http://ns.adobe.com/Map/1.0/sType/Font#"
Mmlns:MapG=3D"http://ns.adobe.com/Map/1.0/g/">
<MapTPg:NPages>1</MapTPg:NPages>
<MapTPg:HasVisibleTransparency>True</
MapTPg:HasVisibleTransparency>
<MapTPg:HasVisibleOverprint>True</MapTPg:HasVisibleOverprint>
<MapTPg:MaMPageSize rdf:parseType=3D"Resource">
<stDim:w>210.000145</stDim:w>
<stDim:h>297.000067</stDim:h>
<stDim:unit>Millimeters</stDim:unit>
</MapTPg:MaMPageSize>
<MapTPg:Fonts>
<rdf:Bag>
<rdf:li rdf:parseType=3D"Resource">
<stFnt:fontName>FranklinGotCdITC-Demi</
stFnt:fontName>
<stFnt:fontFamily>FranklinGotCdITC</
stFnt:fontFamily>
<stFnt:fontFace>Demi</stFnt:fontFace>
<stFnt:fontType>Type 1</stFnt:fontType>
<stFnt:versionString>001.000</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>Frankgotcditcdem; -franklin
Gothic Condensed Itc</stFnt:fontFileName>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stFnt:fontName>FranklinGotCdITC-Book</
stFnt:fontName>
<stFnt:fontFamily>FranklinGotCdITC</
stFnt:fontFamily>
<stFnt:fontFace>Book</stFnt:fontFace>
<stFnt:fontType>Type 1</stFnt:fontType>
<stFnt:versionString>001.000</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>Frankgotcditcboo; -franklin
Gothic Condensed Itc</stFnt:fontFileName>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stFnt:fontName>ITCFranklinGothicStd-Demi</
stFnt:fontName>
<stFnt:fontFamily>ITC Franklin Gothic Std</
stFnt:fontFamily>
<stFnt:fontFace>Demi</stFnt:fontFace>
<stFnt:fontType>Open Type</stFnt:fontType>
<stFnt:versionString>Version 2.031;PS
002.000;hotconv 1.0.50;makeotf.lib2.0.16970</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>ITCFranklinGothicStd-Demi.otf</
stFnt:fontFileName>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stFnt:fontName>FranklinGothic-Condensed</
stFnt:fontName>
<stFnt:fontFamily>Franklin Gothic</stFnt:fontFamily>
<stFnt:fontFace>Condensed</stFnt:fontFace>
<stFnt:fontType>Type 1</stFnt:fontType>
<stFnt:versionString>001.000</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>FrankGotCon; Franklin Gothic
Cond</stFnt:fontFileName>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stFnt:fontName>FranklinGothic-EMtraCond</
stFnt:fontName>
<stFnt:fontFamily>Franklin Gothic</stFnt:fontFamily>
<stFnt:fontFace>EMtra Condensed</stFnt:fontFace>
<stFnt:fontType>Type 1</stFnt:fontType>
<stFnt:versionString>001.000</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>FrankGotEMtCon; Franklin Gothic
Cond</stFnt:fontFileName>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<stFnt:fontName>FranklinGotCdMdITC</stFnt:fontName>
<stFnt:fontFamily>Franklin Got Cd Md ITC</
stFnt:fontFamily>
<stFnt:fontFace>Regular</stFnt:fontFace>
<stFnt:fontType>Type 1</stFnt:fontType>
<stFnt:versionString>001.000</stFnt:versionString>
<stFnt:composite>False</stFnt:composite>
<stFnt:fontFileName>Frankgotcdmditc; -franklin
Gothic Condensed Itc</stFnt:fontFileName>
</rdf:li>
</rdf:Bag>
</MapTPg:Fonts>
<MapTPg:PlateNames>
<rdf:Seq>
<rdf:li>Cyan</rdf:li>
<rdf:li>Magenta</rdf:li>
<rdf:li>Yellow</rdf:li>
<rdf:li>Black</rdf:li>
<rdf:li>Green spot color</rdf:li>
<rdf:li>Gold Printing</rdf:li>
<rdf:li>GREEN Stamping</rdf:li>
<rdf:li>GOLD Stamping</rdf:li>
</rdf:Seq>
</MapTPg:PlateNames>
<MapTPg:SwatchGroups>
<rdf:Seq>
<rdf:li rdf:parseType=3D"Resource">
<MapG:groupName>Default Swatch Group</
MapG:groupName>
<MapG:groupType>0</MapG:groupType>
<MapG:Colorants>
<rdf:Seq>
<rdf:li rdf:parseType=3D"Resource">
<MapG:swatchName>GOLD Stamping</
MapG:swatchName>
<MapG:type>SPOT</MapG:type>
<MapG:tint>100.000000</MapG:tint>
<MapG:mode>RGB</MapG:mode>
<MapG:red>242</MapG:red>
<MapG:green>190</MapG:green>
<MapG:blue>25</MapG:blue>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<MapG:swatchName>GREEN Stamping</
MapG:swatchName>
<MapG:type>SPOT</MapG:type>
<MapG:tint>100.000000</MapG:tint>
<MapG:mode>RGB</MapG:mode>
<MapG:red>0</MapG:red>
<MapG:green>166</MapG:green>
<MapG:blue>80</MapG:blue>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<MapG:swatchName>Gold Printing</
MapG:swatchName>
<MapG:type>SPOT</MapG:type>
<MapG:tint>100.000000</MapG:tint>
<MapG:mode>RGB</MapG:mode>
<MapG:red>240</MapG:red>
<MapG:green>180</MapG:green>
<MapG:blue>28</MapG:blue>
</rdf:li>
<rdf:li rdf:parseType=3D"Resource">
<MapG:swatchName>Green spot color</
MapG:swatchName>
<MapG:type>SPOT</MapG:type>
<MapG:tint>100.000000</MapG:tint>
<MapG:mode>RGB</MapG:mode>
<MapG:red>12</MapG:red>
<MapG:green>177</MapG:green>
<MapG:blue>74</MapG:blue>
</rdf:li>
</rdf:Seq>
</MapG:Colorants>
</rdf:li>
</rdf:Seq>
</MapTPg:SwatchGroups>
</rdf:Description>
<rdf:Description rdf:about=3D""
Mmlns:pdf=3D"http://ns.adobe.com/pdf/1.3/">
<pdf:Producer>Adobe PDF library 8.00</pdf:Producer>
</rdf:Description>
</rdf:RDF>
</M:Mmpmeta>
|