Pls help me : Is there a code for printing and export profile fields

for example in page i am listing profile fields or metadata like this

name address location city

------------------------

-----------------

for all the members registered in my site .....

i got two buttons . one is for printing and another one for exporting into pdf

i need to print and export the field which i listed using elgg_get_entities_from_metadata

can u give me some suggestion so tat i can implement that in my project

 

 

thanks

sathish kumar

  • I'm afraid this is getting a bit too complicated to be resolved using just the community forums. I recommend studying the documentation of both Elgg and TCPDF a bit more. Once you can narrow down more specific questions, the community can surely be of help again.

  • @juho jaakkola   i need ur help using the below coding i can get the pdf ........ but my problem is... i need to get the profile manager field like name city address state etc ...can you tell how can i bring tat inside html tag...

     


    $pdf_filename ='example.pdf';

    $tcpdf_lib = dirname(dirname(dirname(__FILE__))) . '/assets/tcpdf/';
    pdf_export_get_config();
    require_once($tcpdf_lib . 'tcpdf.php');

    //if (empty($pdf_header_title)) $pdf_header_title = PDF_HEADER_TITLE;
    //if (empty($pdf_header_string)) $pdf_header_string = PDF_HEADER_STRING;
    if (empty($pdf_header_logo)) $pdf_header_logo = PDF_HEADER_LOGO;
    if (empty($pdf_header_logo_width)) $pdf_header_logo_width = PDF_HEADER_LOGO_WIDTH;

    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('sathish kumar');
    $pdf->SetTitle('TCPDF Example 001');
    $pdf->SetSubject('TCPDF Tutorial');
    $pdf->SetKeywords('TCPDF, PDF, example, test, guide');

    // set default header data
    //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
    $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
    $pdf->setFooterData(array(0,64,0), array(0,64,128));
    // set default footer data
    //$pdf->setFooterData($tc=array(0,64,0), $lc=array(0,64,128));

    // set header and footer fonts
    $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));

    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);

    //set margins
    // Marges globales (header affichés dans marge top)
    //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetMargins(PDF_MARGIN_LEFT, 20, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);

    //set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);

    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);

    //set some language-dependent strings
    if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
    require_once(dirname(__FILE__).'/lang/eng.php');
    $pdf->setLanguageArray($l);
    }

    $pdf->setFontSubsetting(true);

    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('dejavusans', '', 14, '', true);

    // add a page
    $pdf->AddPage();
    $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));

    $html = <<<EOD

    Welcome to  TCPDF !

    This is the first example of TCPDF library.

    This text is printed using the writeHTMLCell() method but you can also use: Multicell(), writeHTML(), Write(), Cell() and Text().

    Please check the source code documentation and other examples for further information.

    TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE MAKE A DONATION!

    EOD;// output the HTML content
    $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);

    // reset pointer to the last page
    $pdf->lastPage();

    // ---------------------------------------------------------
    //Close and output PDF document
    // $pdf->Output($pdf_filename, 'I');
    ob_clean();
    $pdf->Output($pdf_filename, 'D');

  • inside this html tag

    $html = <<<EOD<h1>Welcome to <a href="http://www.tcpdf.org" style="text-decoration:none;background-color:#CC0000;color:black;">&nbsp;<span style="color:black;">TC</span><span style="color:white;">PDF</span>&nbsp;</a>!</h1><i>This is the first example of TCPDF library.</i><p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p><p>Please check the source code documentation and other examples for further information.</p><p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="http://sourceforge.net/donate/index.php?group_id=128076">MAKE A DONATION!</a></p>EOD;// output the HTML content

  • It is very difficult to read large amount of code like that here in the forums.

    It would be much easier for people to help you with the plugin if you would add it as a git repository to GithubBitbucket or some other similar service. (This is however off-topic, so let's not talk more about this in this discussion thread. Internet is full of tutorials on how to start using git and the mentioned services.)

  • i want know how to display profile content like city and address inside $html

  • i want know how to display profile content like city and address inside $html

    Could it be that you already asked this once and got the answer already?
    http://community.elgg.org/discussion/view/1577112/how-to-get-the-values-of-metadata-and-display-it

  • yup driesdk ur right ......... i am doing that research only ,,,,,,,,

    thnks man

  • its working ........ i thought that it wont work ..... but get_entities itself working :D