Pdfmake: Tables+Text inside columns don't print

Created on 9 Sep 2017  路  3Comments  路  Source: bpampuch/pdfmake

I'm trying to do something like this: https://docs.google.com/document/d/1cDi9YZIyO8i6Pf9WwgoPhSlWW-dwArj0Ax2H4Oz8B9g/edit?usp=sharing

Where you have in two columns text and then a stat box. However once I make the table and text written above it doesn't print.

such as:

    {columns: [
 {     text: 'Client- Nicole Barnes ' ,
        table: {
        widths: [ '*',  '*'],
        body: [
          [ 'First', 'Second' ],
          [ 'Value 1', 'Value 2' ],
          [ { text: 'Bold value', bold: true }, 'Val 2' ]
        ]
      }
 },
    {table: {
        widths: [ '*',  '*'],

        body: [
          [ 'First', 'Second'],
          [ 'Value 1', 'Value 2' ],
          ['Val 3', 'Val 4' ]
        ]
      }}
    ]}  
  ],

doesn't print the text 'Client- Nicole Barnes

Most helpful comment

This is correct definition for what you want:

var dd = {

    content: [

    {
        columns: [
        {
            stack: [
            {     text: 'Client- Nicole Barnes '} ,            
            { table: {
                widths: [ '*',  '*'],
                body: [
                    [ 'First', 'Second' ],
                    [ 'Value 1', 'Value 2' ],
                    [ { text: 'Bold value', bold: true }, 'Val 2' ]
                ]
            } }
            ]

        },

        {
            table: {
            widths: [ '*',  '*'],
            body: [
              [ 'First', 'Second'],
              [ 'Value 1', 'Value 2' ],
              ['Val 3', 'Val 4' ]
            ]
          }

        }
        ]
    }  

    ]
}

All 3 comments

You have to set Widths. Example: widths:['',''] or widths:[10,10]

Thanks for the great extension. I'm using it right now for my charcter generator.
http://jonathandaar.com/games/BlueBlazes/AdventureGenerator/
But I have had a hard time deducing how to do stuff without documentation.
I don't understand what widths you are telling me to set. If you are talking about the table I already did that, if you are talking about the columns, I've never seen that before in the playground example and it doesn't seem to work.
An example of using tables with formating in columns in the playground would be very helpful.

This is correct definition for what you want:

var dd = {

    content: [

    {
        columns: [
        {
            stack: [
            {     text: 'Client- Nicole Barnes '} ,            
            { table: {
                widths: [ '*',  '*'],
                body: [
                    [ 'First', 'Second' ],
                    [ 'Value 1', 'Value 2' ],
                    [ { text: 'Bold value', bold: true }, 'Val 2' ]
                ]
            } }
            ]

        },

        {
            table: {
            widths: [ '*',  '*'],
            body: [
              [ 'First', 'Second'],
              [ 'Value 1', 'Value 2' ],
              ['Val 3', 'Val 4' ]
            ]
          }

        }
        ]
    }  

    ]
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

Christian24 picture Christian24  路  3Comments

SummerSonnet picture SummerSonnet  路  3Comments

svenyonson picture svenyonson  路  3Comments

imoum007 picture imoum007  路  3Comments

dgrice picture dgrice  路  3Comments