Devilzc0de Forum Follow @devilzc0de
  • Home
  • Hacking
  • Networking
  • Programming
  • O.S
  • Server
  • Tweets
  • Search
  • Member List
  • Calendar
Current time: 06-19-2013, 01:28 PM Hello There, Guest! (Login — Register)
Devilzc0de Forum › Information Technology › Programming › PHP v
« Previous 1 ... 12 13 14 15 16 ... 32 Next »

[Solved] FPDF error saat di jalankan Secara Online

Home General Computer Multimedia Business Lounge

Post Reply 
Tweet
Threaded Mode | Linear Mode
Solved FPDF error saat di jalankan Secara Online
05-31-2012, 04:01 PM (This post was last modified: 06-01-2012 08:03 PM by anbu.)
Post: #1
kecap Offline
./Devilz 1st Cadet
Posts: 47
Joined: Jun 2011
Reputation: 0
FPDF error saat di jalankan Secara Online
siang mas mas mohon pencerahan,,
aku kan mau bikin report dengan FPDF pas tak jalanin di localhos tu jadi tapi pas tak coba jalanin di web server online daat di download gak jadi keluar tulisan

"FPDF error: Some data has already been output, can't send PDF file (output started at /home/firstbag/public_html/absen/admin-web/modul/laporan/lap_datang.php:1) ":mewekmewek
dah tak coba googling googling belum nemu juga,,,

scripnya "
PHP Code:
<?php
  
    
require_once("../../resources/dudok/fpdf.php");
     
    class 
FPDF_AutoWrapTable extends FPDF {
    private 
$data = array();
    private 
$options = array(
    
'filename' => 'dudok',
    
'destinationfile' => 'I',
    
'paper_size'=>'F4',
    
'orientation'=>'P'
    
);
     
    function 
__construct($data = array(), $options = array()) {
    
parent::__construct();
    
$this->data = $data;
    
$this->options = $options;
    }
     
    public function 
rptDetailData () {
    
//
    
$border = 0;
    
$this->AddPage();
    
$this->SetAutoPageBreak(true,60);
    
$this->AliasNbPages();
    
$left = 25;
     
    
//header
    
$this->SetFont("", "B", 15);
    
$this->MultiCell(0, 12, 'PT. TELKOM INDONESIA');
    
$this->Cell(0, 1, " ", "B");
    
$this->Ln(10);
    
$this->SetFont("", "B", 12);
    
$this->SetX($left); $this->Cell(0, 10, 'LAPORAN ABSENSI MITRA KEDATANGAN', 0, 1,'C');
    
$this->Ln(10);
     
    
$h = 20;
    
$left = 0;
    
$top = 80;
    
#tableheader
    
$this->SetFillColor(200,200,200);
    
$left = $this->GetX();
    
$this->Cell(20,$h,'NO',1,0,'L',true);
    
$this->SetX($left += 20); $this->Cell(75, $h, 'NAMA', 1, 0, 'C',true);
    
$this->SetX($left += 75); $this->Cell(100, $h, 'MITRA', 1, 0, 'C',true);
    
$this->SetX($left += 100); $this->Cell(70, $h, 'JAM', 1, 0, 'C',true);
    
$this->SetX($left += 70); $this->Cell(100, $h, 'TANGGAL', 1, 0, 'C',true);
    
$this->SetX($left += 100); $this->Cell(100, $h, 'LOKASI', 1, 0, 'C',true);
     
$this->SetX($left += 100); $this->Cell(100, $h, 'IP', 1, 1, 'C',true);
    
//$this->Ln(20);
     
    
$this->SetFont('Arial','',12);
    
$this->SetWidths(array(20,75,100,70,100,100,100));
    
$this->SetAligns(array('C','L','L','L','L','L','L'));
    
$no = 1; $this->SetFillColor(255);
    foreach (
$this->data as $baris) {
    
$this->Row(
    array(
$no++,
    
$baris['nama'],
    
$baris['mitra'],
    
$baris['jam'],
    
$baris['tanggal'],
    
$baris['lokasi'],
    
$baris['ip']
    ));
    }
     
    }
     
    public function 
printPDF () {
     
    if (
$this->options['paper_size'] == "F4") {
    
$a = 8.3 * 72; //1 inch = 72 pt
    
$b = 13.0 * 72;
    
$this->FPDF($this->options['orientation'], "pt", array($a,$b));
    } else {
    
$this->FPDF($this->options['orientation'], "pt", $this->options['paper_size']);
    }
     
    
$this->SetAutoPageBreak(false);
    
$this->AliasNbPages();
    
$this->SetFont("helvetica", "B", 10);
    
//$this->AddPage();
     
    
$this->rptDetailData();
     
    
$this->Output($this->options['filename'],$this->options['destinationfile']);
    }
     
    private 
$widths;
    private 
$aligns;
     
    function 
SetWidths($w)
    {
    
//Set the array of column widths
    
$this->widths=$w;
    }
     
    function 
SetAligns($a)
    {
    
//Set the array of column alignments
    
$this->aligns=$a;
    }
     
    function 
Row($data)
    {
    
//Calculate the height of the row
    
$nb=0;
    for(
$i=0;$i<count($data);$i++)
    
$nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
    
$h=10*$nb;
    
//Issue a page break first if needed
    
$this->CheckPageBreak($h);
    
//Draw the cells of the row
    
for($i=0;$i<count($data);$i++)
    {
    
$w=$this->widths[$i];
    
$a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
    
//Save the current position
    
$x=$this->GetX();
    
$y=$this->GetY();
    
//Draw the border
    
$this->Rect($x,$y,$w,$h);
    
//Print the text
    
$this->MultiCell($w,10,$data[$i],0,$a);
    
//Put the position to the right of the cell
    
$this->SetXY($x+$w,$y);
    }
    
//Go to the next line
    
$this->Ln($h);
    }
     
    function 
CheckPageBreak($h)
    {
    
//If the height h would cause an overflow, add a new page immediately
    
if($this->GetY()+$h>$this->PageBreakTrigger)
    
$this->AddPage($this->CurOrientation);
    }
     
    function 
NbLines($w,$txt)
    {
    
//Computes the number of lines a MultiCell of width w will take
    
$cw=&$this->CurrentFont['cw'];
    if(
$w==0)
    
$w=$this->w-$this->rMargin-$this->x;
    
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
    
$s=str_replace("\r",'',$txt);
    
$nb=strlen($s);
    if(
$nb>0 and $s[$nb-1]=="\n")
    
$nb--;
    
$sep=-1;
    
$i=0;
    
$j=0;
    
$l=0;
    
$nl=1;
    while(
$i<$nb)
    {
    
$c=$s[$i];
    if(
$c=="\n")
    {
    
$i++;
    
$sep=-1;
    
$j=$i;
    
$l=0;
    
$nl++;
    continue;
    }
    if(
$c==' ')
    
$sep=$i;
    
$l+=$cw[$c];
    if(
$l>$wmax)
    {
    if(
$sep==-1)
    {
    if(
$i==$j)
    
$i++;
    }
    else
    
$i=$sep+1;
    
$sep=-1;
    
$j=$i;
    
$l=0;
    
$nl++;
    }
    else
    
$i++;
    }
    return 
$nl;
    }
    }
     

    include 
'../../../config/koneksi.php';
     
    
#ambil data dari DB dan masukkan ke array
    
$data = array();
    
$query = "SELECT nama, mitra, jam, tanggal, lokasi,ip FROM datang ORDER BY lokasi";
    
$sql = mysql_query ($query);
    while (
$row = mysql_fetch_assoc($sql)) {
    
array_push($data, $row);
    }
     
    
//pilihan
    
$options = array(
    
'filename' => '', 
    
'destinationfile' => '', //I=inline browser (default), F=local file, D=download
    
'paper_size'=>'F4', //paper size: F4, A3, A4, A5, Letter, Legal
    
'orientation'=>'P' //orientation: P=portrait, L=landscape
    
);
     
    
$tabel = new FPDF_AutoWrapTable($data, $options);
    
$tabel->printPDF();
    
    
?>
mohon bantuanya ya,,,,belajarbelajar
Find all posts by this user
Quote this message in a reply
05-31-2012, 08:03 PM
Post: #2
whitecoinDC Offline
security dc :metal
**
Moderators
Posts: 732
Joined: Apr 2011
Reputation: 18
RE: FPDF error saat di jalankan Secara Online
ane plajarin dulu omz... belajar
Visit this user's website Find all posts by this user
Quote this message in a reply
05-31-2012, 08:48 PM
Post: #3
ceoode Offline
./Devilz Officer
Posts: 50
Joined: Nov 2011
Reputation: 1
RE: FPDF error saat di jalankan Secara Online
barusan nyoba script mu q om,
n hasil nya ok, pdf nya mau keluar ketawa

script nya udah bener kok, tapi karena beberapa kesalahan kecil seperti yang dijelaskan disini,
"http://stackoverflow.com/questions/9475686/fpdf-error-some-data-has-already-been-output-cant-send-pdf"

itu script jadi macet, ketawa

ini udah q coba, silahkan di download hasilnya disini om ketawa

http://www.mediafire.com/?d6663ltl1u841rr

tambahan aja om, kalo pengin lebih simple, om nya bisa make fpdf table (turunan dari fpdf), penggunaanya lebih mudah dan powerfull ketawa

semangat ketawa
Find all posts by this user
Quote this message in a reply
06-01-2012, 03:00 PM
Post: #4
kecap Offline
./Devilz 1st Cadet
Posts: 47
Joined: Jun 2011
Reputation: 0
RE: FPDF error saat di jalankan Secara Online
makasi banget OM,,,,sumpah membantu banget,,,Thanks ya,,,,Oy ternyata kemarin setelah tak koreksi aku juga melakukan kesalahan ,,,hehehehehe maklum newbie,,,ternyata kalau bikin skrip php di depan tanda <? gak boleh ada sepase ya,,,hehehehehehe,,,,aku baru tau,,,oy gan makasi banget ya mantapmantap
Find all posts by this user
Quote this message in a reply
06-01-2012, 07:39 PM
Post: #5
ceoode Offline
./Devilz Officer
Posts: 50
Joined: Nov 2011
Reputation: 1
RE: FPDF error saat di jalankan Secara Online
(06-01-2012 03:00 PM)kecap Wrote:  makasi banget OM,,,,sumpah membantu banget,,,Thanks ya,,,,Oy ternyata kemarin setelah tak koreksi aku juga melakukan kesalahan ,,,hehehehehe maklum newbie,,,ternyata kalau bikin skrip php di depan tanda <? gak boleh ada sepase ya,,,hehehehehehe,,,,aku baru tau,,,oy gan makasi banget ya mantapmantap


sama-sama bro ketawa
boleh kok, kata siapa nggak boleh ? ketawa
untuk kasus2 tertentu terjadi error (salah satu nya kasus yang ada output file nya)
Find all posts by this user
Quote this message in a reply
06-05-2012, 04:38 PM
Post: #6
kecap Offline
./Devilz 1st Cadet
Posts: 47
Joined: Jun 2011
Reputation: 0
RE: FPDF error saat di jalankan Secara Online
maaf bang kali ini aku mau tanya lagi,,,masih berkutik dengan skrip yang di atas,,masalahnya aku agak bingung kalau mau ngluarin isi dari 2 kolom di tabel data base ke dalam satu kolom di dalam tampilan Fpdf itu gimana ya bang aku coba skrip kayak gini kok gak bisa ya,,,
contohnya aku pengen ngluarin filt tanggal dan bulan menjadi satu kolom di PDF.


<?php

require_once("../../resources/dudok/fpdf.php");

class FPDF_AutoWrapTable extends FPDF {
private $data = array();
private $options = array(
'filename' => '',
'destinationfile' => '',
'paper_size'=>'F4',
'orientation'=>'P'
);

function __construct($data = array(), $options = array()) {
parent::__construct();
$this->data = $data;
$this->options = $options;
}

public function rptDetailData () {
//
$border = 0;
$this->AddPage();
$this->SetAutoPageBreak(true,60);
$this->AliasNbPages();
$left = 25;

//header
$this->SetFont("", "B", 15);
$this->MultiCell(0, 12, 'PT. TELKOM INDONESIA');
$this->Cell(0, 1, " ", "B");
$this->Ln(10);
$this->SetFont("", "B", 12);
$this->SetX($left); $this->Cell(0, 10, 'LAPORAN ABSENSI MITRA KEDATANGAN', 0, 1,'C');
$this->Ln(10);

$h = 20;
$left = 0;
$top = 80;
#tableheader
$this->SetFillColor(200,200,200);
$left = $this->GetX();
$this->Cell(20,$h,'NO',1,0,'L',true);
$this->SetX($left += 20); $this->Cell(75, $h, 'NAMA', 1, 0, 'C',true);
$this->SetX($left += 75); $this->Cell(100, $h, 'MITRA', 1, 0, 'C',true);
$this->SetX($left += 100); $this->Cell(70, $h, 'JAM', 1, 0, 'C',true);
$this->SetX($left += 70); $this->Cell(100, $h, '/Bulan', 1, 0, 'C',true);
$this->SetX($left += 100); $this->Cell(100, $h, 'LOKASI', 1, 0, 'C',true);
$this->SetX($left += 100); $this->Cell(100, $h, 'IP', 1, 1, 'C',true);
//$this->Ln(20);

$this->SetFont('Arial','',12);
$this->SetWidths(array(20,75,100,70,100,100,100));
$this->SetAligns(array('C','L','L','L','L','L','L'));
$no = 1; $this->SetFillColor(255);
foreach ($this->data as $baris) {
$this->Row(
array($no++,

$baris['nama'],
$baris['mitra'],
$baris['jam'],
$baris['tanggal']&['bulan'];
$baris['lokasi'],
$baris['ip']
));
}

}

public function printPDF () {

if ($this->options['paper_size'] == "F4") {
$a = 8.3 * 72; //1 inch = 72 pt
$b = 13.0 * 72;
$this->FPDF($this->options['orientation'], "pt", array($a,$b));
} else {
$this->FPDF($this->options['orientation'], "pt", $this->options['paper_size']);
}

$this->SetAutoPageBreak(false);
$this->AliasNbPages();
$this->SetFont("helvetica", "B", 10);
//$this->AddPage();

$this->rptDetailData();

$this->Output($this->options['filename'],$this->options['destinationfile']);
}

private $widths;
private $aligns;

function SetWidths($w)
{
//Set the array of column widths
$this->widths=$w;
}

function SetAligns($a)
{
//Set the array of column alignments
$this->aligns=$a;
}

function Row($data)
{
//Calculate the height of the row
$nb=0;
for($i=0;$i<count($data);$i++)
$nb=max($nb,$this->NbLines($this->widths[$i],$data[$i]));
$h=10*$nb;
//Issue a page break first if needed
$this->CheckPageBreak($h);
//Draw the cells of the row
for($i=0;$i<count($data);$i++)
{
$w=$this->widths[$i];
$a=isset($this->aligns[$i]) ? $this->aligns[$i] : 'L';
//Save the current position
$x=$this->GetX();
$y=$this->GetY();
//Draw the border
$this->Rect($x,$y,$w,$h);
//Print the text
$this->MultiCell($w,10,$data[$i],0,$a);
//Put the position to the right of the cell
$this->SetXY($x+$w,$y);
}
//Go to the next line
$this->Ln($h);
}

function CheckPageBreak($h)
{
//If the height h would cause an overflow, add a new page immediately
if($this->GetY()+$h>$this->PageBreakTrigger)
$this->AddPage($this->CurOrientation);
}

function NbLines($w,$txt)
{
//Computes the number of lines a MultiCell of width w will take
$cw=&$this->CurrentFont['cw'];
if($w==0)
$w=$this->w-$this->rMargin-$this->x;
$wmax=($w-2*$this->cMargin)*1000/$this->FontSize;
$s=str_replace("\r",'',$txt);
$nb=strlen($s);
if($nb>0 and $s[$nb-1]=="\n")
$nb--;
$sep=-1;
$i=0;
$j=0;
$l=0;
$nl=1;
while($i<$nb)
{
$c=$s[$i];
if($c=="\n")
{
$i++;
$sep=-1;
$j=$i;
$l=0;
$nl++;
continue;
}
if($c==' ')
$sep=$i;
$l+=$cw[$c];
if($l>$wmax)
{
if($sep==-1)
{
if($i==$j)
$i++;
}
else
$i=$sep+1;
$sep=-1;
$j=$i;
$l=0;
$nl++;
}
else
$i++;
}
return $nl;
}
}


include '../../../config/koneksi.php';

#ambil data dari DB dan masukkan ke array
$data = array();
$query = "SELECT nama, mitra, jam, tanggal,bulan, lokasi,ip FROM datang ORDER BY bulan";
$sql = mysql_query ($query);
while ($row = mysql_fetch_assoc($sql)) {
array_push($data, $row);
}

//pilihan
$options = array(
'filename' => '',
'destinationfile' => '', //I=inline browser (default), F=local file, D=download
'paper_size'=>'F4', //paper size: F4, A3, A4, A5, Letter, Legal
'orientation'=>'P' //orientation: P=portrait, L=landscape
);

$tabel = new FPDF_AutoWrapTable($data, $options);
$tabel->printPDF();
?>[/quote]
mohon pencerahanya Gan...
Find all posts by this user
Quote this message in a reply
08-24-2012, 01:24 PM
Post: #7
brianfahmi Offline
./Devilz Advisor
Posts: 774
Joined: Aug 2012
Reputation: 11
RE: FPDF error saat di jalankan Secara Online
Nice Share
Visit this user's website Find all posts by this user
Quote this message in a reply
« Next Oldest | Next Newest »
Post Reply 


Topic Tools
Topic Link :
BBCode :
HTML Code :
View a Printable Version Send Thread to a Friend Subscribe to this thread
Submit Google Submit Face book Submit to Digg Submit to Reddit Submit to Furl Submit to Del.icio.us Submit to Jeqq

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  [Ask] Ajax Error youngmartin45 5 93 05-28-2013 09:25 AM
Last Post: mariachi
  [Solved] ERROR "Warning: mysql_num_rows()" Login PHP anyo_ateng 12 261 05-10-2013 11:15 PM
Last Post: Beruang Kabur
  [Solved] Tanya tentang PHP (Pengkoneksian database error) agarirs 7 140 04-05-2013 07:23 PM
Last Post: qball006_error
  PART-2, REMOTE SHUTDOWN KOMPUTER VIA WEB SMS ONLINE K4pT3N 18 2,349 03-17-2013 08:44 AM
Last Post: â„¢NewOrder
  [Tutor] Menyimpan Log Error Query SQL Untuk Troubleshooting c1ck0 7 234 01-01-2013 01:12 PM
Last Post: sotbot
  [Ask] cara menampilkan spasi antar kata di fpdf region 5 288 10-21-2012 05:41 AM
Last Post: antaliga
  [Ask] FPDF data tidak mau tampil semuanya, cuma 1 baris aja region 3 160 09-23-2012 02:56 AM
Last Post: adiscsi
  [Ask] tanya auto resize colum table FPDF region 2 187 09-20-2012 04:19 AM
Last Post: region
  CD Tutorial Pembuatan building SMS Manager Online cancer 2 250 08-24-2012 10:53 PM
Last Post: Killu4
  [Ask] [Logika User Online] Joris 28 3,841 08-24-2012 01:26 PM
Last Post: brianfahmi

Users Browsing
1 Guest(s)

  • Contact Us
  • devilzc0de
  • Return to Top
  • Mobile Version
  • RSS Syndication
  • Help
Current time: 06-19-2013, 01:28 PM Powered By MyBB, © 2002-2013 MyBB Group. Theme created by Justin S. | Mixed By Chaer.Newbie | Fixed By Aditya

USING THIS SITE INDICATES THAT YOU HAVE READ AND ACCEPT OUR TERMS. IF YOU DO NOT ACCEPT THESE TERMS, YOU ARE NOT AUTHORIZED TO USE THIS SITE