使用 iText 将 \ DropDown 组件滚动到 PDF
让我解释一下我真正想要的:
我已经成功使用 iText 库将 JPanel 及其所有组件导出到 PDF。
但是我遇到了一些问题。我想使用 iText 将 JScrollPane 导出为 PDF...这可能吗?好吧,从技术上来说......因为它对我有用......但是我的 JScrollPane 实际上是滚动的......那么我如何将 JScrollPane 导出到 PDF 并保留 JScrollPane 的属性。我知道 pdf 文档确实支持这一点,正如我所看到的那样。
请帮忙... 我不确定您实际上是否需要任何代码...
我这样做的方式是将 JPanel 转换为图形,然后将其导出为 pdf
let me explain what i actually want:
i have managed to successfully export my JPanel along with all its components to a PDF using iText's library.
However i have run into a bit of a problem. I would like to export a JScrollPane to PDF using iText... is this even possible? well it is, technically... cause it works for me.. however my JScrollPane actually scrolls... so how can i export the JScrollPane to a PDF keeping the JScrollPane's properties. i know that pdf documents do support this as i have seen it.
Please help...
i'm not sure if you require any code actually...
the way i've been doing it is converting the JPanel to a graphic then exporting that to pdf
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
pdf PDF 中唯一滚动的是列表字段。如果您可以将 JScrollPane 的内容硬塞到字符串列表选项中,那就太好了。如果不是的话……不太好。
嵌入 Flash
这意味着将 JScrollPanel 转换为 PDF,然后将该 PDF 转换为 Flash(带有滚动条),然后将该 Flash 嵌入到 PDF 中。呃,但是应该可以。
嘿!
按钮和 JavaScript
您可以将按钮的外观设置为模板(“图标”)。您可以在按钮的范围内调整图像的缩放和对齐方式(垂直和水平)。如果你可以在javascript中调整这种对齐方式,你就可以模拟滚动条。是的!
我建议使用
PushbuttonField
来构建所有这些内容,一个用于每个控件,一个用于 JScrollPanel。您将面板的滚动行为设置为“从不”,并将初始图标对齐设置为合理的(我想是“顶部”)。如果您想真正变得更奇特,您甚至可以使用更多脚本以及buttonAlignX和buttonAlignY在向上和向下箭头之间制作比例滑块。我不认为你会支持拖拽。
丑陋的缩放
一种在视觉上不太吸引人的替代方案是保留所有数据,将滚动面板的内容以完整尺寸、未剪辑的方式绘制到模板中。然后,您可以按比例缩小该模板以适合原始对话框上的可用区域。人们可能必须放大才能看到任何东西,但随后他们就可以看到一切。没有时髦的脚本魔法,只是一个看起来时髦的 PDF 对话框之类的东西。
The only thing that scrolls within a pdf PDF is a list field. If you can shoehorn the contents of your JScrollPane into string list options, great. If not... not so great.
Embedded Flash
That means converting your JScrollPanel to PDF and converting that PDF to Flash (with a scroll bar) and embedding that flash in your PDF. Ugh, but it should work.
Hey!
Pushbuttons and JavaScript
You can set the appearance of a button to be a template (an "icon"). You can adjust the scaling and alignment (both vertical and horizontal) of the image within the bounds of the button. If you can adjust this alignment in javascript, you can simulate scroll bars. YEP!
I suggest using
PushbuttonField
to build all this stuff, one for each control and one for the JScrollPanel. You set the panel's scroll behavior to "never" and the initial icon alignment to be something reasonable ("top" I'd imagine).If you wanted to get REALLY fancy, you could even do proportional sliders between the up and down arrows with more script and buttonAlignX and buttonAlignY. I don't think you could support dragging.
Ugly scaling
A less visually appealing alternative that would preserve all your data would be to draw the contents of your scroll panel at full size, unclipped, into a template. You'd then scale that template down proportionately to fit the available area on the original dialog. Folks might have to zoom in to see anything, but then they could see everything. No funky script magic, just a funky looking PDF-dialog-thingy.