用于Prawn生成的PDF的Windows 8 Reader中的PDF图形问题

时间:2022-09-04 21:10:24

I have a Rails application that generates PDF using Prawn.

我有一个使用Prawn生成PDF的Rails应用程序。

There are some rounded_rectangle declarations that render correctly in Adobe Reader but not Windows 8's Reader. In Windows Reader, these elements simply aren't displayed. The only broken elements are the rounded_rectangles.

有一些rounded_rectangle声明可以在Adobe Reader中正确呈现,但不能在Windows 8的Reader中正确呈现。在Windows Reader中,不会显示这些元素。唯一被破坏的元素是rounded_rectangles。

Some of my Prawn code:

我的一些Prawn代码:

pdf.stroke do
  pdf.rounded_rectangle [box_left, box_top], box_width, box_height, box_radius
end

which works great in Adobe Reader.

这在Adobe Reader中很有用。

1 个解决方案

#1


0  

I was embedding an image as the background image using

我正在使用嵌入图像作为背景图像

pdf.bounding_box([0, height], :width => width) do
  pdf.image background, :fit => [width, height]
end

but for some reason this caused any graphics to fall in a layer underneath this image. Using the image as a background or simply not putting it in the bounding box resolved the issue.

但由于某种原因,这会导致任何图形落入此图像下方的图层中。将图像用作背景或者不将其放在边界框中解决了问题。

#1


0  

I was embedding an image as the background image using

我正在使用嵌入图像作为背景图像

pdf.bounding_box([0, height], :width => width) do
  pdf.image background, :fit => [width, height]
end

but for some reason this caused any graphics to fall in a layer underneath this image. Using the image as a background or simply not putting it in the bounding box resolved the issue.

但由于某种原因,这会导致任何图形落入此图像下方的图层中。将图像用作背景或者不将其放在边界框中解决了问题。