Prawn pdf nested tables - cannot find examples

I need to create a document with nested tables in shrimp pdf.

The most recent answer to this question seems to indicate that I can do this as follows:

(Prawn::Document.generate("subtable.pdf") do |pdf| subtable = pdf.make_table([["sub"],["table"]]) pdf.table([[subtable,"original"]]) end 

Unfortunatley does this with the following error:

 undefined method `size=' for #<Prawn::Table::Cell::Subtable:0xad3f1e4> 

So, check out the documentation that I see: "You can use Prawn :: Document # make_table to create a table to use as a subtable without drawing it directly. See /table/bill.rb examples for a bit complicated use of subtables." http://prawn.majesticseacreature.com/docs/0.11.1/Prawn/Table.html

Where can I see this example /table/bill.rb? I cloned the github repository, browsed the site and the manual, but can't find these examples anywhere!

I know I'm missing something stupid. Does anyone know how to correctly insert tables into prawn pdf and / or where are the sample files?

Thanks for any help

+4
source share
2 answers

make:

gem that shrimp

which will provide you the location of the shrimp gem. It includes examples of dir. Here you can find the table / bill.rb.

+4
source

I would suggest taking a look at the self-recording guide scroll down (or use ctrl-f) to go to "content_and_subtables" and you can see how they are used.

If you still have problems, send a message with the full text of the error message and an example of the code used. That way, we can debug the problem you are facing and see something in your code or another problem in general.

0
source

Source: https://habr.com/ru/post/1434032/


All Articles