Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 使用单页眉和重复页脚制作虾桌_Ruby_Pdf_Prawn - Fatal编程技术网

Ruby 使用单页眉和重复页脚制作虾桌

Ruby 使用单页眉和重复页脚制作虾桌,ruby,pdf,prawn,Ruby,Pdf,Prawn,我正在用Prawn生成一个PDF,它在第一页上有一个页眉,一个重复的页脚,整个页面都有表数据 如果添加不带边框的表,它将从页眉后开始,但与页脚重叠。 如果我将表格放在边界框中,它将避开页脚。但为了避免出现标题,我必须将其放置在标题下方,然后在随后的每一页上都会丢失该空间 还有其他方法吗?在prawn的github上找到了答案。它要求您将表格包装在边界框中,并手动设置边界框的开始位置,这只会影响第一页 # ... draw your first-page header here # Sto

我正在用Prawn生成一个PDF,它在第一页上有一个页眉,一个重复的页脚,整个页面都有表数据

如果添加不带边框的表,它将从页眉后开始,但与页脚重叠。 如果我将表格放在边界框中,它将避开页脚。但为了避免出现标题,我必须将其放置在标题下方,然后在随后的每一页上都会丢失该空间


还有其他方法吗?

在prawn的github上找到了答案。它要求您将表格包装在边界框中,并手动设置边界框的开始位置,这只会影响第一页

  # ... draw your first-page header here
  # Store away the y-position below the header on the first page
  old_y = y
  # Start a bounding box the size of the page (excluding the footer)
  bounding_box([bounds.left, bounds.top],
      :width => bounds.width, :height => bounds.height - FooterHeight) do
    # Restore the old y-position for the first page
    self.y = old_y
    table(...)
  end