publisher
publisher copied to clipboard
Space gets dropped before number
Hi @pgundlach, this issue comes from #388:
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<SetGrid width="1mm" height="1mm"/>
<Record element="data">
<SetVariable variable="myfile" select="$external_pdfdoc"/>
<Output>
<Text>
<Paragraph>
<Value select="sd:number-of-pages($myfile)"/>
<Value> </Value>
<Value select="sd:imagewidth($myfile)"/>
<Value> </Value>
<Value select="sd:imageheight($myfile)"/>
<Value> </Value>
<Value select="sd:aspectratio($myfile)"/>
</Paragraph>
</Text>
</Output>
</Record>
</Layout>
The output from sp -v external_pdfdoc=../a.pdf --autoopen --dummy
reads:
1 297 2101.41428570553
With any PDF document, I get no space before the output from <Value select="sd:aspectratio($myfile)"/>
.
I only get an space before, if I replace it with &nnbsp;
(I get no space even with
).
Is this a bug or am I missing something basic?
Many thanks for your help.
This is a bug. A workaround would be to add string()
here:
<Value select="string(sd:aspectratio($myfile))"/>
Thank you!
BTW, in https://github.com/speedata/publisher/discussions/388#discussioncomment-3098943 you mention imagewidth()
.
I cannot find this expression (imagewidth()
) in the docs or in this repository (searching inside GitHub).
I guess it is related to current PDF (the document generated by Publisher), but how would be imagewidth()
invoked?
Many thanks for your help.
Sorry, I think that with this:
sd:imageheight($myfile, 'mm')
returns the number of millimetres (same withimagewidth()
).
you simply meant sd:imagewidth($myfile, 'mm')
.
Sorry for the noise again.
Sorry, I think that with this:
sd:imageheight($myfile, 'mm')
returns the number of millimetres (same withimagewidth()
).you simply meant
sd:imagewidth($myfile, 'mm')
.
exactly, sorry for not being clear.
Many thanks for the fix.
This has some unwanted side effects... I need to re-open the issue.
<Layout xmlns="urn:speedata.de:2009/publisher/en"
xmlns:sd="urn:speedata:2009/publisher/functions/en">
<Record element="data">
<PlaceObject>
<Textblock>
<Paragraph>
<Span background-color="lightgray">
<Value>abcdef</Value>
<Value> </Value>
</Span>
</Paragraph>
</Textblock>
</PlaceObject>
</Record>
</Layout>