Need to disable an automatic URL hyperlinking with XSL-FO when generating a PDF document?

落爺英雄遲暮 提交于 2021-01-27 23:30:46

问题


I'm using Apache XSL-FO to generate a PDF document from an XML using XSLT. In my XSL file I have an fo:block where I bring a URL and simply display it like this: xsl:value-of select="company_info/website"

My website always contains a valid URL for some company, starting with www.abc.com

It seems like that by default anything with a www is being recognized as a URL and becomes linkable. It does not seem like I can force the link of that company to load in a new window, as it always loads the page in the PDF window and that's not a desirable behavior. I am trying to find a way to disable to URL altogether so that it is not linkable and the only way I'm able to do it tight now is by inserting '-' on both ends of the URL: -www.abc.com- Is there a more elegant way to insert some kind of a special character that maybe is not visible?


回答1:


This is probably not something that can be fixed from the XSLT/XSL-FO side of things (except by inserting extra characters, as you have done). It is the PDF viewer that interprets certain strings as clickable links.

In Adobe Reader, you can disable automatic recognition of links by unchecking the "Create links from URLs" check box (Preferences dialog: General->Basic tools). Foxit Reader has this option too.



来源:https://stackoverflow.com/questions/6203613/need-to-disable-an-automatic-url-hyperlinking-with-xsl-fo-when-generating-a-pdf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!