PDF 中的 RDLC 嵌入图像变形
我有一个非常简单的 RDLC 报告,我在标题中使用 PNG 图像构建了该报告。经过多次试验,我们无法获得外部图像来与分期和生产中的报告配合使用。
然后,我将图像嵌入到 RDLC 中并部署更新的文件。图像在 ReportViewer 控件中显示良好。然而,当使用查看器的导出功能获取 PDF 时,图像会出现乱码和扭曲。它基本上看起来就像是《星球大战》的介绍文字,但垂直重复直到消失。这种情况在我的测试机和阶段/生产中都会发生。
我在嵌入图像时是否做错了什么?我考虑过是否可以以另一种方式对图像进行 MIME 编码,然后将其插入到 RDLC 中。不过,工作似乎很紧张。
I have a very simple RDLC report I've built with a PNG image in the header. After many trials we could not get external images to work with the report in staging and production.
I then embedded the image in the RDLC and deployed the updated file. The image displays in the ReportViewer control fine. However, when using the export functionality of the viewer to get a PDF the image comes out garbled and distorted. It basically looks as if the image was like the Star Wars intro text but repeated vertically till it disappears. This happens both on my test machine and in stage/production.
Is there something I'm not doing correctly with embedding the image? I've thought about seeing if I could MIME encode the image another way and then insert that into the RDLC. Seems stretched to work though.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
想通了这一点。
在某种程度上,它确实与编码有关。看来 PNG 编码正在做一些奇怪的事情。我尝试了 JPEG 和 GIF 编码,并且都可以在 ReportViewer 和 PDF 导出中使用。我尝试更改为不同的 PNG(透明和不透明),但遇到了各种失真问题。
我的建议是,如果在 ReportViewer 中使用将导出为 PDF 的嵌入图像,则应使用 GIF 或 JPEG 来嵌入 RDLC 中。
Figured this out.
It does have to do with the encoding, in a way. It appears that the PNG encoding is doing weird things. I tried JPEG and GIF encodings and both work in the ReportViewer and PDF export. I tried changing to different PNGs (transparency and non-transparent) and had various distortion issues.
It is my suggestion that if using an embedded image with the ReportViewer that will be exported to PDF that you should use GIFs or JPEGs for embedding in your RDLC.
我刚刚遇到这个问题。对我来说,您可以从 SSRS 预览生成的 PDF 显示 PNG 就很好了。但是,当我将报告发布到 SharePoint,然后管理电子邮件订阅以发送 PDF 时,该 PDF 显示的图像完全扭曲(基本上是倾斜的图像,然后垂直重复)。就我而言,我使用的是分辨率大于 4000 x 4000 的 PNG 文件。我将其大小调整为更像 1200 x 1200 的大小,并且订阅中的 PDF 显示了 PNG 效果很好。
I just encountered this issue. For me, the PDF you can generate from the SSRS preview showed the PNG just fine. But when i published the report to SharePoint and then managed email subscriptions to send a PDF, that PDF showed the image all screwy (basically tilted image and then repeated vertically). In my case, I was using a PNG file that had a resolution of greater than 4000 x 4000. I resized it to something more like 1200 x 1200 and the PDF from the subscription showed the PNG just fine.