jQWidgets Forums

jQuery UI Widgets Forums Grid PDF Local server Export

This topic contains 4 replies, has 3 voices, and was last updated by  DavidSimmons 11 years, 11 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • PDF Local server Export #21360

    DavidSimmons
    Participant

    Is there anything needed special for exporting PDF. I have my CSV working but the PDF just locks up.

    var exportPDFButton = $(“

    “);
    exportPDFButton.find(‘span’).addClass(‘ui-icon ui-icon-arrowthickstop-1-s’);
    exportPDFButton.width(16);
    exportPDFButton.jqxTooltip({content: ‘Export PDF!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme});
    exportPDFButton.appendTo(tableLeft);

    exportPDFButton.click(function (event) {
    $(jqxgrid).jqxGrid(‘exportdata’, ‘pdf’, jqxgrid, true, null, true, ‘http://192.168.1.10/jqw/save-file.php’);
    });

    var exportCSVButton = $(“

    “);
    exportCSVButton.find(‘span’).addClass(‘ui-icon ui-icon-arrowthickstop-1-s’);
    exportCSVButton.width(16);
    exportCSVButton.jqxTooltip({content: ‘Export CSV!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme});
    exportCSVButton.appendTo(tableLeft);

    exportCSVButton.click(function (event) {
    $(jqxgrid).jqxGrid(‘exportdata’, ‘csv’, jqxgrid, true, null, true, ‘http://192.168.1.10/jqw/save-file.php’);
    });

    PDF Local server Export #21361

    Peter Stoev
    Keymaster

    Hi David,

    PDF export is not supported. That is why you will not be able to use it.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com/

    PDF Local server Export #21380

    gtielemans
    Participant

    Dear Peter,

    A complex PDF is dificult, but a simple dump of a table?
    I like your demo with the six buttons for export data.

    I wonder:

    If you “intercept” the output from the CSV as starting point,
    then with the help of a libray like TCPDF, http://www.tcpdf.org/examples.php

    you can create a simple PDF table (and place it under PHP integration?)

    Greetings, Ger

    PDF Local server Export #25026

    DavidSimmons
    Participant

    Here is a simple PDF Report example if anyone would like it using fpdf…. If anyone like I will provide a working example link…

    Called from a button on the grid….
    var pdfButton = $(“

    “);
    pdfButton.find(‘span’).addClass(‘ui-icon ui-icon-print’);
    pdfButton.width(16);
    pdfButton.jqxTooltip({content: ‘PDF Report!’, position: ‘mouse’, name: ‘Tooltip’, theme: theme});
    pdfButton.appendTo(tableLeft);

    pdfButton.click(function (event) {
    $(“#message”).html(“PDF Report”);
    window.open(“../CompanyTab/CompanyReport.php”);
    });

    SetCreator ( “Creator” );
    $pdf->SetAuthor ( $_SESSION[ ‘UserName’ ] );
    $pdf->SetKeywords ( ‘Company Report ‘ . date ( “Y/m/d H:i” ) );
    $pdf->SetSubject ( “Company PDF Report” );
    $pdf->setTitle ( ‘Company Report’ );
    $pdf->setPageWidth ( 334 );
    $pdf->AliasNbPages ();
    $pdf->DataColumns ( $conn, $meta );
    $pdf->Data ( $conn, $sql );
    $pdf->SetFont ( ‘Arial’, ”, 7 );
    $pdf->AddPage ();
    $pdf->DataTable ();
    $pdf->Output ();

    ?>

    PDF Local server Export #25028

    DavidSimmons
    Participant

    Sorry Forgot to include this class….

    title = $title;
    }

    function setPageWidth($pageWidth){
    $this->pageWidth = $pageWidth;
    }

    function DataColumns ( $conn, $meta )
    {
    $preparedStatement = $conn->prepare ( $meta );
    if ( $preparedStatement->execute () ) {
    $result = $preparedStatement->fetchAll ();
    if ( $preparedStatement->rowCount () > 0 ) {
    foreach ( $result as $key => $value ) {
    $column = Array();
    foreach ( $value as $key => $value ) {
    $field = Array();
    if ( !is_int ( $key ) ) {
    array_push ( $field, $key, $value );
    array_push ( $column, $field );
    }

    }
    array_push ( $this->header, $column );
    }
    }
    }
    }

    function Data ( $conn, $sql )
    {
    $preparedStatement = $conn->prepare ( $sql );
    if ( $preparedStatement->execute () ) {
    $result = $preparedStatement->fetchAll ();
    if ( $preparedStatement->rowCount () > 0 ) {
    foreach ( $result as $key => $value ) {
    $row = Array();
    foreach ( $value as $key => $value ) {
    if ( !is_int ( $key ) ) {
    array_push ( $row, $value );
    }
    }
    array_push ( $this->data, $row );
    }
    }
    }
    }

    function DataTable ( )
    {
    // Color and font restoration
    $this->SetFillColor ( 224, 235, 255 );
    $this->SetTextColor ( 0 );
    //$this->SetFont ( ” );

    $count = count ( $this->data );
    $fill = false;
    foreach ( $this->data as $row ) {
    $columnCount=0;
    foreach ( $row as $column ) {
    $this->Cell ( ($this->header[ $columnCount ][ 2 ][ 1 ])+10, 5, $column, 1, 0, ‘L’, $fill );
    $columnCount++;
    }
    $this->Ln ();
    $fill = !$fill;
    }
    //$this->Cell ( array_sum ( $w ), 0, ”, ‘T’ );
    }

    function Header()
    {
    $this->SetFont(”,’B’,10);
    $this->Cell($this->pageWidth,10,$this->title,1,0,’C’);
    $this->Ln(20);

    $this->SetFillColor ( 125, 175, 251 );
    $this->SetTextColor ( 255 );
    $this->SetDrawColor ( 128, 0, 0 );
    $this->SetLineWidth ( .3 );
    $this->SetFont(”,’B’,8);
    // Header
    $w = array( 20, 20, 20, 20 );
    for ( $i = 0; $i header ); $i++ ) {
    $this->Cell ( ($this->header[ $i ][ 2 ][ 1 ])+10, 6, $this->header[ $i ][ 0 ][ 1 ], 1, 0, ‘C’, true );
    }
    $this->Ln ();
    }

    function Footer()
    {
    $this->SetY(-15);
    $this->SetFont(‘Arial’,’I’,7);
    $this->Cell(0,10,’Page ‘.$this->PageNo().’ of {nb}’,0,0,’C’);
    }

    }

    ?>

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.