You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by chitgoks <ch...@gmail.com> on 2019/06/06 08:58:39 UTC
creating measurement dictionaries
hi. to anyone familiar with measure dictionaries, i would like to ask a few
questions .
please check the image. this area, for example i set as 30.335 mm,
for this one, calibration value is 0.00039965mm
and this is how i create a measure dictionary. it worked before when i was
basing it via pixels but now since i am taking into account actual
measurement, i have not been so lucky getting it right
COSDictionary measureDictionary = new COSDictionary();
measureDictionary.setItem(COSName.TYPE,
COSName.getPDFName("Measure"));
measureDictionary.setItem(COSName.R, new COSString("1 mm = 1 mm"));
COSDictionary xDictionary = new COSDictionary();
xDictionary.setItem(COSName.TYPE,
COSName.getPDFName("NumberFormat"));
xDictionary.setItem(COSName.U, new COSString("mm"));
xDictionary.setItem(COSName.C, new COSFloat( 0.00039965 f ));
COSArray xarr = new COSArray();
xarr.add(xDictionary);
measureDictionary.setItem(COSName.getPDFName("X"), xarr);
COSDictionary dDictionary = new COSDictionary();
dDictionary.setItem(COSName.TYPE,
COSName.getPDFName("NumberFormat"));
dDictionary.setItem(COSName.U, new COSString("mm"));
dDictionary.setItem(COSName.C, new COSFloat(0.00039965 f));
COSArray darr = new COSArray();
darr.add(dDictionary);
measureDictionary.setItem(COSName.D, darr);
COSDictionary aDictionary = new COSDictionary();
aDictionary.setItem(COSName.TYPE,
COSName.getPDFName("NumberFormat"));
aDictionary.setItem(COSName.U, new COSString("mm"));
aDictionary.setItem(COSName.C, new COSFloat(0.00039965f));
COSArray aarr = new COSArray();
aarr.add(aDictionary);
measureDictionary.setItem(COSName.A, aarr);
See anything wrong? or lacking?
Re: creating measurement dictionaries
Posted by Tilman Hausherr <TH...@t-online.de>.
Hi,
No image was attached. You need to upload it somewhere.
I can't help much. You should use PDFDebugger to inspect your file and a
file generated by an Adobe product and then decide what is missing.
Tilman
Am 06.06.2019 um 10:58 schrieb chitgoks:
> hi. to anyone familiar with measure dictionaries, i would like to ask
> a few questions .
> please check the image. this area, for example i set as 30.335 mm,
>
> for this one, calibration value is 0.00039965mm
>
> and this is how i create a measure dictionary. it worked before when i
> was basing it via pixels but now since i am taking into account actual
> measurement, i have not been so lucky getting it right
>
> COSDictionary measureDictionary = new COSDictionary();
> measureDictionary.setItem(COSName.TYPE,
> COSName.getPDFName("Measure"));
> measureDictionary.setItem(COSName.R, new COSString("1 mm = 1
> mm"));
>
> COSDictionary xDictionary = new COSDictionary();
> xDictionary.setItem(COSName.TYPE,
> COSName.getPDFName("NumberFormat"));
> xDictionary.setItem(COSName.U, new COSString("mm"));
> xDictionary.setItem(COSName.C, new COSFloat( 0.00039965 f ));
> COSArray xarr = new COSArray();
> xarr.add(xDictionary);
> measureDictionary.setItem(COSName.getPDFName("X"), xarr);
>
> COSDictionary dDictionary = new COSDictionary();
> dDictionary.setItem(COSName.TYPE,
> COSName.getPDFName("NumberFormat"));
> dDictionary.setItem(COSName.U, new COSString("mm"));
> dDictionary.setItem(COSName.C, new COSFloat(0.00039965 f));
> COSArray darr = new COSArray();
> darr.add(dDictionary);
> measureDictionary.setItem(COSName.D, darr);
>
> COSDictionary aDictionary = new COSDictionary();
> aDictionary.setItem(COSName.TYPE,
> COSName.getPDFName("NumberFormat"));
> aDictionary.setItem(COSName.U, new COSString("mm"));
> aDictionary.setItem(COSName.C, new COSFloat(0.00039965f));
> COSArray aarr = new COSArray();
> aarr.add(aDictionary);
> measureDictionary.setItem(COSName.A, aarr);
>
> See anything wrong? or lacking?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: users-help@pdfbox.apache.org