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
Get integer from metadata variable
No, I don't think so. Have you tried emailing Apago support?
I'm just a dude. Anything I say has nothing to do with any other person or company.
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Get integer from metadata variable
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
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
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
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
-
- TOP CONTRIBUTOR
- Posts: 628
- Joined: Mon Nov 29, 2010 8:45 pm
- Location: Alpharetta GA USA
- Contact:
Get integer from metadata variable
That will work; however, Switch variables only give the page boxes for a single page whereas PDFspy gives the page boxes for every page.