• Resolved Linda

    (@lindali2007)


    For a website with a lot of tables, I’m using TablePress.
    To have the option to download the table as pdf, I’m using the add-on DataTables Buttons. This is working great, but there is one table which is too large to fit on the pdf file.
    Is there a way I can style the pdf layout or change the margins or settings for the pdf so that all the columns will fit on the pdf. Or maybe change it from portrait view to landscape?

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    I see what you mean, but unfortunately, I don’t know how the PDF output can be influenced 🙁 This is done by an external JavaScript library.

    Maybe you could create a PDF for this manually (e.g. in Excel) and offer it for download on that table’s page?

    Regards,
    Tobias

    Hi,
    I’m from panama in my case I modified the tablepress-datatables-buttons.php code and added an additional button to place a configuration according to the documentation found on the datatables site for the cases of pdfHtml5 below I detail my code

    $shirt = array(
        'extend' => 'pdfHtml5',
    	'text'=>'PDFHorizontal',
        'orientation' => 'landscape',
    	'pageSize' => 'TABLOID',
         
    );
    		$parameters['buttons'] = '"buttons":['.json_encode($shirt).','.implode(',',$js_options['datatables_buttons']).']';
          
    		return $parameters;
    	}

    For me it was the solution without affecting the rest of the buttons that use the shortcode with this code by pressing the button it automatically generates my horizontal pdf plus I put the page size in “TABLOID” because my tables have many columns.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    very nice! Thanks for sharing this solution!

    Best wishes,
    Tobias

    Thanks for sharing, @bonargerodriguez – this is just what I’m looking for. However, I’m not sure where in the tablepress-datatables-buttons.php file to insert the code. Can you please advise?

    Also, to show the new option as a button on the page, do I just add “pdfHtml5” to the shortcode, or is it something else?

    Thanks again,
    Jason

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi Jason,

    unfortunately, I don’t know the details to that solution, but let’s hope that bonargerodriguez can maybe help.

    Regards,
    Tobias

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Change layout generated pdf’ is closed to new replies.