XSL-fo pdf 的图像大小问题
我有大量的 XML 文档,这些文档是在 docbook 中创建的,并通过 maven 以 html 和 pdf 形式发布。各代工作正常,html 看起来也不错。我遇到的问题是 pdf 版本中图像的大小。这些图像是屏幕截图的集合,有些是全屏的,有些是大约 2/3 的宽度和高度,还有一些是小搜索框。显然,我需要对图像数据的属性进行大规模重构。我想知道我应该将其重构为什么呢?我正在寻找一种方法来创建最多 4 种“类型”的图像,并让它们强制执行自己的尺寸调整。 图像的示例如下所示:
<section><title>Screenshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="./views/screenshots/editNote.png" scalefit="0" width="100%"/>
</imageobject>
</mediaobject>
</section>
它仅适用于我的某些屏幕截图尺寸。
我尝试过scalefit、width和contentwidth/contentheight,它们似乎解决了问题的不同部分。我也应该查看视口吗?
注意:不用担心会破坏 html 生成,因为我可以在 XSL 中打开“排除属性”。
I have a large number of XML documents which are created in docbook and, through maven, are published in both an html for and a pdf form. The generations works fine, and the html looks fine. The issue i'm having is in the size of the images in the pdf version. The images are a collection of screenshots, some are full screen, some about 2/3rds width and height, and others are small search boxes. It's obvious that I need to do a massive refactor of the attributes of the imagedata. I was wondering what should I refactor it to? I'm looking for a way to create up to 4 'types' of images and for these to enforce their own sizing.
An example of an image looks like this:
<section><title>Screenshot</title>
<mediaobject>
<imageobject>
<imagedata fileref="./views/screenshots/editNote.png" scalefit="0" width="100%"/>
</imageobject>
</mediaobject>
</section>
And it only works for some of my screenshot sizes.
I've played around with scalefit, width, and contentwidth/contentheight and they seem solve different portions of the problem. Should I be looking into viewports as well?
NOTE: There is not fear of breaking html generation since I can turn on 'exclude properties' in the XSL.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
严格来说这并不是您要问的问题,但是您是否标准化了图像文件中的 DPI 设置?尽管在 HTML 渲染中被忽略,但它们在 docbook->PDF 渲染中至关重要。
当我过去处理过这个问题时,修复 DPI 使我无需进一步调整 DocBook 源。
This isn't strictly what you're asking, but have you normalized the DPI settings in your image files? Though ignored in HTML rendering, they're crucial in docbook->PDF rendering.
When I've dealt with this in the past, fixing the DPI left me with no need to further tweak the DocBook source.
您有
@scalefit="0"
尝试使用@scalefit="1"
:http://www.sagehill.net/docbookxsl/ImageSizing.html
You have
@scalefit="0"
try with@scalefit="1"
:http://www.sagehill.net/docbookxsl/ImageSizing.html