Yii Framework Forum: Generate And Print Pdf File - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Generate And Print Pdf File Rate Topic: -----

#1 Guest_zqrt_*

  • Group: Guests

Posted 22 April 2013 - 09:30 AM

Hi ,
i am trying to write a function that create PDF files and print it , So to generate PDFs i use this extension
http://www.yiiframew.../extension/pdf/
its very easy :) , but i want to print the file after generation.
Function:
public function actionPrintPDF()
    {
        # mPDF
        $PDF = Yii::app()->ePdf->mpdf();
        $PDF = Yii::app()->ePdf->mpdf('', 'A4');
        $PDF ->WriteHTML($this->render('_PDF_Template', true));
        $PDF ->Output();
}


in view its looks like this :
Attached File  Capture.JPG (115.57K)
Number of downloads: 105


how can i make the browser print after pressing the print button instead of open the PDF file in page ?

thank you :)
0

#2 User is offline   Keith 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 1,653
  • Joined: 04-March 10
  • Location:UK

Posted 22 April 2013 - 10:54 AM

You'd need to use javascript to trigger the print dialog:

http://stackoverflow...rint-a-web-page
0

#3 Guest_zqrt_*

  • Group: Guests

Posted 22 April 2013 - 12:06 PM

View PostKeith, on 22 April 2013 - 10:54 AM, said:

You'd need to use javascript to trigger the print dialog:


window.print();


print current page , i need to print specific page from template

is there any way ?

thanks
0

#4 User is offline   bravantia 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 06-March 13

Posted 10 May 2013 - 01:13 PM

View Postzqrt, on 22 April 2013 - 12:06 PM, said:

window.print();


print current page , i need to print specific page from template

is there any way ?

thanks


You can try with mPrint widget to print all the content you can place inside a div...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users