Perintah print pada web

Perintah print pada web
23 May 2019 108 Comments pemrograman2 Site Default

Untuk menggunakan perintah print kita bisa menggunakan windoes print, PDF atau Exel

nah sekarang kita masuk ke cetak dengan perintah windows print. Pertama kita harus buat tombol cetak pada halaman yang mau kita cetak, misal saya mau cetak halaman siswa maka saya buat sebuah menu cetak pada halaman tersebut, boleh berupa gambar boleh berupa button. contoh pada gambar dibawah terdapat gambar printer sebagai simbol untuk print. Tombol tersebut kita buat sebuah link menuju fungsi yang akan kita bikin di controller.

Selanjutnya kita harus buat dulu fungsi cetak pada Controller, kalau mengikuti dari awal berarti controller yang saya gunakan adalah C_belajar buatlah fungsi cetak.

public function window(){
	$data['tampilan'] = $this->m_belajar->tampilan('siswa')->result();
	$this->load->view('window',$data);
}

dan model cukup pakai fungsi tampil yang pernah kita pakai sebelumnya.

public function tampil($table){
		return $this->db->get($table);
		}

selanjutnya, seperti tercantum pada controller kita menggunakan view windows.php perintahnya adalah sebagai berikut :

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Window Print BUS</title>

    <link rel="stylesheet"  href="<?php echo base_url()?>bootstrap/dist/css/bootstrap.min.css">
    <!-- icon -->
    <link rel="icon" type="image/png" href="<?php echo base_url()?>asset/image/bus.png">

</head>

<style>
    body{
        background: ;
    }

    .container{
        padding: 30px;
        margin-top: 20px;
    }

    .container h1{
        margin-bottom:20px;
    }
</style>

<body onload="window.print()">

<div class="container">

<h1>Data Siswa</h1>

<table border="1" width="100%" class="text-center">
<tr>
    <td>No</td>
      <th>Nama</th>
      <th>Nis</th>
      <th>Alamat</th>

  </tr>
  <tr>
      <?php $no=1;
   foreach ($tampilan as $bebas){
   	?>
   	<td><?php echo $no++;?></td>
   	<td><?php echo $bebas->nama;?></a></td>
   	<td><?php echo $bebas->nis;?></td>
    <td><?php echo $bebas->alamat;?></td>
   	</td>
   </tr>
   <?php } ;?>
</table>

</div>

</body>
</html>


pada view diatas terdapat perintah

<body onload="window.print()">
fungsinya disini adalah setiap kita load halaman ini maka akan selalu muncul halaman print (window.print")

Sekian penjelasannya selamat mencoba dan terimakasih.

Tags
About The Author
Leave Comment
  1. 1

    geico.com home

    [url=https://homeinsuranceqts.com/]10 top homeowners insurance companies[/url]

  2. 1

    Henry Hunter

    Thankfulness to my father who shared with me about this weblog, this blog is really remarkable.

  3. 1

    cvs viagra cost

    cvs viagra cost

    cvs viagra cost

  4. 1

    Arthur Meyer

    Hello there! This post could not be written any better! Going through this article reminds
    me of my previous roommate! He continually kept preaching about this.
    I am going to forward this article to him. Fairly certain he will have a great read.
    Thank you for sharing!

  5. 1

    Barbara Melendez

    I’ve been surfing online greater than three hours lately, yet I by no
    means found any attention-grabbing article like yours.
    It is pretty worth enough for me. In my view, if all webmasters and bloggers made
    excellent content material as you probably did, the web can be a lot more helpful
    than ever before.

  6. 1

    low cost viagra and cialis

    low cost viagra and cialis

    low cost viagra and cialis

  7. 1

    Luke Hill

    I have been browsing online more than 4 hours today, yet I never found any interesting
    article like yours. It is pretty worth enough for me. Personally, if all
    website owners and bloggers made good content as you did,
    the net will be a lot more useful than ever before.

  8. 1

    Margaret Brown

    I absolutely love your blog.. Excellent colors & theme.
    Did you make this amazing site yourself? Please reply back as I’m hoping to create my own personal site and would love to learn where you got this from or just what the theme is named.
    Many thanks!

  9. 1

    Valarie Hintz

    I blog often and I really appreciate your content.
    This article has really peaked my interest. I will take a note of your site and keep
    checking for new information about once per week.
    I subscribed to your Feed too.

  10. 1

    Travis Lane

    I’ll right away seize your rss feed as I can’t find your email subscription link or e-newsletter service.

    Do you’ve any? Kindly allow me realize so that I could subscribe.
    Thanks.

  11. 1

    purchase viagra

    I needed to draft you one little bit of observation so as to say thanks once again for your lovely opinions you’ve documented in this article. It is quite remarkably generous of people like you to deliver openly exactly what a number of us could possibly have marketed as an e book to end up making some cash for themselves, most importantly given that you could possibly have done it if you ever decided. These pointers also served like the fantastic way to comprehend other people have similar eagerness like my own to realize significantly more with reference to this problem. I know there are some more pleasurable situations up front for people who scan through your website.

  12. 1

    viagra generic

    Thank you for every one of your labor on this web site. My daughter really loves making time for investigations and it’s really obvious why. Most people learn all regarding the lively mode you present reliable tactics through this web site and even inspire participation from some others on the point then our favorite princess is now starting to learn a whole lot. Take advantage of the rest of the year. You are always doing a remarkable job.

  13. 1

    propecia online

    Thanks for your own labor on this web site. My mother take interest in participating in research and it is simple to grasp why. My spouse and i notice all regarding the powerful way you produce valuable tips via your website and in addition recommend response from the others on this subject then our own princess is undoubtedly studying a whole lot. Take pleasure in the rest of the year. You have been performing a terrific job.

  14. 1

    order abilify

    I precisely had to appreciate you all over again. I am not sure the things that I might have followed in the absence of the entire methods documented by you directly on such industry. It had become a real distressing crisis in my circumstances, however , encountering the skilled form you managed that made me to jump over fulfillment. I’m just happier for this guidance and even hope you find out what a great job you are doing instructing other individuals through your blog post. I am sure you have never encountered all of us.

  15. 1

    Dora Russell

    It’s the best time to make a few plans for the future and it’s time to be happy.
    I have read this submit and if I may I wish
    to recommend you few attention-grabbing issues or advice. Perhaps you can write subsequent articles relating to this article.
    I wish to learn more things about it!

  16. 1

    cheap venlafaxine

    Thank you for every one of your labor on this web site. My daughter really loves making time for investigations and it’s really obvious why. Most people learn all regarding the lively mode you present reliable techniques through this web site and even inspire participation from some others on the point then our favorite princess is really starting to learn a whole lot. Take advantage of the rest of the year. You are always doing a splendid job.

  17. 1

    imipramine online

    My wife and i have been so peaceful when Michael managed to finish up his studies via the precious recommendations he obtained using your web site. It is now and again perplexing to simply happen to be offering techniques which often some others might have been trying to sell. We remember we need you to thank for this. The type of illustrations you made, the straightforward website navigation, the relationships your site make it easier to instill – it is most spectacular, and it is letting our son in addition to us reckon that this subject matter is pleasurable, which is certainly truly serious. Thanks for the whole lot!

  18. 1

    Cynthia Nguyen

    I really like what you guys tend to be up too. This type of clever work and exposure!
    Keep up the wonderful works guys I’ve incorporated you
    guys to my blogroll.

  19. 1

    pov mom viagra

    pov mom viagra

    pov mom viagra

  20. 1

    Joy Post

    I enjoy what you guys are up too. This sort of clever work and coverage!
    Keep up the good works guys I’ve added you guys to my own blogroll.

  21. 1

    cialis 10 mg pills

    cialis 10 mg pills

    cialis 10 mg pills

  22. 1

    George Farrar

    It’s appropriate time to make a few plans for the long run and
    it is time to be happy. I’ve learn this put up and if I could I
    wish to counsel you few interesting things or advice.
    Perhaps you could write next articles referring to this article.
    I wish to read more things approximately it!

  23. 1

    FgvdLearT

    best erectile dysfunction pills best drugstore setting powder cheap viagra online canadian pharmacy

  24. 1

    viagra super active

    viagra super active

    viagra super active

  25. 1

    JlloLycle

    thrifty drug store north drug store express scripts pharmacy

  26. 1

    LokuFrifs

    ed pills that work quickly rx online drugstore pharmacy

  27. 1

    Sterling Reynolds

    These are really wonderful ideas in regarding blogging.
    You have touched some good things here. Any way keep up
    wrinting.

  28. 1

    NllpLearT

    drugstore cowboy http://pharmacy-onlineasxs.com/ pharmacy rx

  29. 1

    Nancy Heberlig

    As I website owner I think the written content here is very superb, appreciate it for your efforts.

  30. 1

    Eyehen

    [url=http://prednisoneotc.com/]steroid prednisone[/url] [url=http://edviagra.com/]viagra medicine[/url] [url=http://chloroquinegen.com/]how to get chloroquine[/url] [url=http://levitraday.com/]levitra pills price in india[/url] [url=http://cialistrial.com/]tadalafil in mexico[/url] [url=http://ivermectincaps.com/]ivermectin canada[/url] [url=http://buyhydrochloroquine.com/]resochina[/url] [url=http://prednisonechem.com/]prednisone acetate[/url] [url=http://doxycyclineotc.com/]doxycycline 100mg acne[/url] [url=http://mcialis.com/]where to buy cialis uk[/url]

  31. 1

    JtmfFrifs

    ed medications discount pharmacy canada rx pharmacy

Leave a reply

Your email address will not be published.