Closed pr-apes closed 11 months ago
You must not use double parentheses in the argument of sd:aspect-ratio()
. Also, the sp
gets ignored.
Try this layout:
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<SetVariable variable="pdfdoc" select="'out.pdf'" />
<Record element="data">
<Loop select="sd:number-of-pages($pdfdoc)" variable="pagenum">
<Message select="sd:aspectratio($pdfdoc, $pagenum, 'mediabox')" />
</Loop>
</Record>
</Layout>
You must not use double parentheses in the argument of
sd:aspect-ratio()
. Also, thesp
gets ignored.
Of course, you are totally right, @pgundlach.
Mixing XPath commands, I forgot that sd:aspectratio()
only outputs width divided by height. This is a proportion, only a number, not a length.
This is why measurement units make no sense at all in sd:aspectratio()
.
Sorry for the noise. Closing the issue myself.
Of course, many thanks for your help, @pgundlach.
@pgundlach,
this layout generates 10 pages (letter size):
This layout generates 10 pages (legal size):
This layout fits in A4 paper size the whole contents of the image (fed with outputs from previous layouts [
sp --dummy --jobname result -v pdfdoc=publisher.pdf
]):Image width is calculated to fit what it reaches first: either page height or page width.
This works fine, but only as long as pages aren't mixed within the same document, such as in:
Or with this layout:
Sorry, but I don't understand what is wrong here.
I mean, width is computed within the loop for each page, but the conditional seems to work only for the first page (applying the same consequence to the rest of the pages in the loop).
Is this a bug or what is wrong in my code?
Many thanks for your help.