speedata / publisher

speedata Publisher - a professional database Publishing system
https://www.speedata.de/
GNU Affero General Public License v3.0
293 stars 36 forks source link

PDF images and Windows paths #502

Closed pr-apes closed 1 year ago

pr-apes commented 1 year ago

@pgundlach,

this comes from #500, this XPath function is problematic in Windows:

sd:aspectratio(concat($pdfdoc, ':', $runpage ':mediabox'))

I use drag and drop to a .bat file in Windows, which provides the full path for $pdfdoc.

It took me a while to realize that full paths in Windows include :, such as in c:\Users\name\Desktop\a.pdf.

So the previous XPath function complains about not being able to find image C.

Sorry, but I don't know how to avoid the colon here. Using URI (either file:// or https://) would have the same problem.

Could you take a look at this? (I wonder whether a syntax such as the one described in https://github.com/speedata/xts/issues/10#issuecomment-1531834227 would make sense here.)

Many thanks for your help.

pgundlach commented 1 year ago

Why is life so complicated? :-)

I'll take a look.

pr-apes commented 1 year ago

Quick and dirty hack, replace colon with semicolon.

So the problematic function would read:

sd:aspectratio(concat($pdfdoc, ';', $runpage ';mediabox'))

It is a dirty workaround. With literally no time to consider other implications.

Just in case it helps.

pr-apes commented 1 year ago

I don't know how many users deploy the colon for image selection.

This would break existing code, of course. Not sure how many people are using this feature.

pgundlach commented 1 year ago

The syntax is now as in XTS (filename, optional page number, optional PDF box, optional unit) - no colons anymore.

I'll close this issue and thank you as always for the valuable feedback!

pr-apes commented 1 year ago

Many thanks for the new implemented syntax.