Yii Framework Forum: [EXTENSION] mprint - Yii Framework Forum

Jump to content

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

[EXTENSION] mprint Rate Topic: -----

#1 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 17 March 2011 - 08:37 PM

I have uploaded an extension and you can find it here.

Feel free to comment and test it.

Here is the latest zip file:
Attached File  mPrint_r3.zip (4.75K)
Number of downloads: 164
Tell your tail.
Don't be shy to upvote a post if it was able to help you
0

#2 User is offline   harits 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 30-January 11

Posted 11 May 2011 - 12:26 PM

hi, thanks for ur extension.

i want ask how to show the background (color or picture) at printing result? i tried to give background at my view.php, but there was blank result.

or Maybe must change the mprint.css file?

thanks for your answer
0

#3 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 14 May 2011 - 11:46 AM

Thanks harits :)

I think your concern is the same with this comment. As of this writing, I can't find a way yet to include the background of the page/element to be printed. Actually, I haven't done enough research about this. Not that I'm not interested in enhancing this, but mainly because my hands are tied with my real life projects.

My apologies for the inconvenience.

Just in case you found a way, kindly let me know and I'll be more than willing to upgrade our extension. :)
Tell your tail.
Don't be shy to upvote a post if it was able to help you
0

#4 User is offline   la-ci 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 04-July 11

Posted 13 July 2011 - 06:03 AM

First of all, great extenstion, thanx.
Now some thought on multiple prints in one page, aka reaction to this comment.
if we fix the 284th line like suggested

Quote

Yii::app()->clientScript->registerScript('processPrint'.$this->id, '



we have to specify different id's for each and every call of widget, because it is set to default id='mprint' when you not set one, and you end up with non working scenario.
here is example, how it could work, with two links to parts of page that can be printed
<?php
$this->breadcrumbs=array(
	'Report Package'=>array('/reportPackage'),
	'Print',
);?>

 <?php
       $this->widget('ext.mPrint.mPrint', array(
            'id' => 'mprint1',  // !!!you have to set up this one if you want multiple prints per page
            'title' => 'Some title for page',        //the title of the document. Defaults to the HTML title
            'tooltip' => 'testing the print',    //tooltip message of the print icon. Defaults to 'print'
            'text' => 'Print table 1 - Some name of table', //text which will appear beside the print icon. Defaults to NULL
            'element' => '#printable1',      //the element to be printed.
            'exceptions' => array(     //the element/s which will be ignored
                '.summary',
                '.search-form'
            ),
            'publishCss' => true       //publish the CSS for the whole page?
        ));
  ?>

<div id="printable1">   <!-- this is where you specify name of section you want to print -->
    <center>
    <h3> Some table name</h3>
    </center>
    <br />
    Registration no: <?php echo '11111111';?>
    <br />
    <br />
    <br />
    <table style="border-collapse: collapse; border:1px solid black;">
        <tr style="border-collapse: collapse; border:1px solid black;">
            <td colspan="2"><b>Responsible person</b></td>
            <td style="border-collapse: collapse; border:1px solid black;">Organization ID</td>
            <td>provide some $model->ico</td>
        </tr>
        <tr style="border-collapse: collapse; border:1px solid black;">
            <td>Name</td>
            <td>$model->name</td>
            <td style="border-collapse: collapse; border:1px solid black;">Person</td>
            <td>$model->filledBy</td>
        </tr>
        <tr>
            <td colspan="2">
                <table>
                    <tr>
                        <td colspan="4">Address</td>
                    </tr>
                    <tr>
                        <td>Street:</td>
                        <td colspan="3"> $model->adresa</td>
                    </tr>
                    <tr>
                        <td>City:</td>
                        <td>$model->city</td>
                        <td>Zip Code:</td>
                        <td>$model->psc</td>
                    </tr>
                    <tr>
                        <td>Telephone:</td>
                        <td>$model->telephone</td>
                        <td>Faxu:</td>
                        <td>$model->fax</td>
                    </tr>
                </table> 
            </td>
            <td colspan="2" style="border-collapse: collapse; border:1px solid black;">
                <table>
                    <tr>
                        <td colspan="4">Address</td>
                    </tr>
                    <tr>
                        <td>Street:</td>
                        <td colspan="3"> $model->adresa</td>
                    </tr>
                    <tr>
                        <td>City:</td>
                        <td>$model->city</td>
                        <td>Zip Code:</td>
                        <td>$model->psc</td>
                    </tr>
                    <tr>
                        <td>Telephone:</td>
                        <td>$model->telephone</td>
                        <td>E-mail:</td>
                        <td>$model->email</td>
                    </tr>
                    <tr>
                        <td>Faxu:</td>
                        <td>$model->fax</td>
                        <td>URL address:</td>
                        <td>$model-web</td>
                    </tr>
                </table> 
            </td>
        </tr>
    </table>
    
    
</div>

 <?php
       $this->widget('ext.mPrint.mPrint', array(
            'id' => 'mprint2',  // !!!you have to set up this one if you want multiple prints per page
            'title' => 'Some page title',        //the title of the document. Defaults to the HTML title
            'tooltip' => 'testing the print',    //tooltip message of the print icon. Defaults to 'print'
            'text' => 'Print table 2 - Evidencia o obaloch', //text which will appear beside the print icon. Defaults to NULL
            'element' => '#printable2',      //the element to be printed.
            'exceptions' => array(     //the element/s which will be ignored
                '.summary',
                '.search-form'
            ),
            'publishCss' => true       //publish the CSS for the whole page?
        ));
  ?>


<div id="printable2">   <!-- this is where you specify name of section you want to print -->
    <h3>Evidencia o obaloch</h3>
    <table>
       <tr> 
         <td> some table
         </td>
       </tr>
    </table>
    
</div>


I think it would be good idea to apply that fix in source, and provide some info on multiple prints with it

la-ci
0

#5 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 13 July 2011 - 11:54 AM

Hi la-ci,

Thanks so much for reminding me. Extension is now updated as requested. Apologies for the inconvenience and the delay.

Thanks again. :)
Tell your tail.
Don't be shy to upvote a post if it was able to help you
0

#6 User is offline   lugaru 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 11

Posted 13 July 2011 - 02:35 PM

Hey,

nice Plugin many Thanks!

Short Question:
Is it Possible to Start the Plugin over an Link in CMENU? I have all action right in a small widget and want to add the print Action there also. THis didn't work =( :
array('label'=>'Print', 'url'=>'#', 'linkOptions'=>array('onclick'=>'void(0)'))

Any Ideas? Thanks!
0

#7 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 14 July 2011 - 01:00 AM

View Postlugaru, on 13 July 2011 - 02:35 PM, said:

Hey,

nice Plugin many Thanks!

Short Question:
Is it Possible to Start the Plugin over an Link in CMENU? I have all action right in a small widget and want to add the print Action there also. THis didn't work =( :
array('label'=>'Print', 'url'=>'#', 'linkOptions'=>array('onclick'=>'void(0)'))

Any Ideas? Thanks!


Thanks lugaru :)

Basically, what you need to do is to trigger the "click" event of your mprint link. I tried doing something like
'linkOptions'=>array('onclick'=>'javascript: $("#div-to-be-printed").click()')

but the quotations are being encoded so it appears in the page lik
<li><a onclick="javascript: $(&quot;#div-to-be-printed&quot;).trigger(&quot;click&quot;);" href="#">Print</a></li>

and does not work.

So what I did was I created a triggering function:
<script type="text/javascript">
function trigger_click(){
	$("#div-to-be-printed").trigger("click");
}
</script>

and then in my menu I put:
 array('label' => 'Print', 'url' => '#', 'linkOptions'=>array('onclick'=>'javascript: trigger_click()'))

and it worked.

I'm not a jquery expert, but I hope I have given you an idea.

Edit:
Just to be clear, the 'div-to-be-printed' is the 'id' of the mprint's print link.

This post has been edited by macinville: 14 July 2011 - 03:07 AM

Tell your tail.
Don't be shy to upvote a post if it was able to help you
2

#8 User is offline   lugaru 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 11

Posted 14 July 2011 - 04:01 AM

Many Thanks macinville :)

works fine =)
0

#9 User is offline   macinville 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 268
  • Joined: 25-October 10
  • Location:Marikina City, Philippines

Posted 14 July 2011 - 10:37 PM

View Postlugaru, on 14 July 2011 - 04:01 AM, said:

Many Thanks macinville :)

works fine =)


Your welcome lugaru :)
Tell your tail.
Don't be shy to upvote a post if it was able to help you
0

#10 User is offline   fouss 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 385
  • Joined: 05-October 10
  • Location:Bamako Mali

Posted 15 July 2011 - 06:03 AM

How to make that work with CGridView?
Posted Image
0

#11 User is offline   MaNiShGaIkWaD 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 23-August 12

Posted 19 October 2012 - 01:26 AM

Not working for chrome

:(

Please sugguest how to force it to use system print dialouge


Thanx
0

#12 User is offline   Jimlam 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 195
  • Joined: 17-March 12

Posted 19 October 2012 - 05:44 AM

Problem with CSS and element to be printed


Hi,

I am having a problem:

When I specify the element to be printed ('element'=>'.pview1',), the output ignores the CSS file settings. If I do not specify the element to be printed, the CSS settings are observed but of course, the whole page is printed.

I do not specify cssFile in the parameters so the default is being used (mprint.css) I added my own settings to this file.

Can anyone help me? Thanks
0

#13 User is offline   eload 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 27-October 12

Posted 14 June 2013 - 07:55 PM

Problem with integration ..

1.I've mPrint_3.zip unpacked under /protected/extensions/mPrint
2.chmod 777

Alias "ext.mPrint.mPrint" is invalid. Make sure it points to an existing PHP file and the file is readable.

where i go wrong ???

Can anyone help? Thanks
0

#14 User is offline   peebowl 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 05-April 13

Posted 07 January 2014 - 11:30 PM

View Postfouss, on 15 July 2011 - 06:03 AM, said:

How to make that work with CGridView?



How to make that .
0

#15 User is offline   Flight 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 17-February 14

Posted 17 February 2014 - 09:46 PM

Hello i am newbie on Yii, i try to using ext mprint but not work, can somebody tell me about tutorial instalation?<br />
and how setup on controller ?
Thanks
0

#16 User is offline   colombo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 12-September 13

Posted 17 March 2014 - 10:39 AM

Hi, I tried to use the extension in a view where the are more than 1 widget, but I have the problem that the first link to print does not have 'href = "javascript: void (0)"' ... can you help me?
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