Page 1 of 1

Get integer from metadata variable

Posted: Tue Nov 02, 2010 9:54 am
by matb
I have this line taken from PDFspy metadata;



[Metadata.Text:Path="/pdfattrs/page[1]/boxes/TrimBox/@height * 0.352777778",Dataset="Pdf",Model="XML"] mm x [Metadata.Text:Path="/pdfattrs/page[1]/boxes/TrimBox/@width * 0.352777778",Dataset="Pdf",Model="XML"] mm



And the result is (eg);



356.001179113142 mm x 599.999929266842 mm



Is it possible to get just the integer (not the decimal points)?

Get integer from metadata variable

Posted: Thu Nov 18, 2010 6:07 am
by mattbeals
No, I don't think so. Have you tried emailing Apago support?

Get integer from metadata variable

Posted: Tue Nov 30, 2010 12:12 pm
by dkelly
Hello, you should be able to use XPath's math operators for rounding floating point numbers to integers.



floor(v)- maps to largest previous integer

ceiling(v) - maps to smallest following integer

round(v) - rounds to closest integer



floor(2.1) = 2

floor(2.5) = 2

ceiling(2.1) = 3

ceiling(2.6) = 3

round(2.1) = 2

round(2.6) = 3



--

Dwight Kelly

Apago, Inc.

dkelly@apago.com

Get integer from metadata variable

Posted: Wed Mar 14, 2012 1:03 am
by manupapet
Hello, i have make the same thing of you without PDFSpy but with the function stats :



function convert() {

var TBWpt = job.getVariableAsNumber( "[Stats.TrimBoxWidth]" );

var TBHpt = job.getVariableAsNumber( "[Stats.TrimBoxHeight]" );

var TBWmm = Math.round( TBWpt * 0.35277 ).toString();

var TBHmm = Math.round( TBHpt * 0.35277 ).toString();

return TBWmm + "x" + TBHmm + "mm-" + PWmm + "x" + PHmm + "mm"

}

convert();



I'm French and I'm sorry for my english.



--------------

Emmanuel MARTIN

Printer

manupapet@yahoo.fr

Get integer from metadata variable

Posted: Wed Mar 14, 2012 10:21 am
by dkelly
That will work; however, Switch variables only give the page boxes for a single page whereas PDFspy gives the page boxes for every page.