FPDF Help
Posted on
16th Feb 2014 07:03 pm by
admin
I've been playing with the FPDF module. I was building a form and rolling right along and then suddenly I started getting the "FPDF error: Some data has already been output, can't send PDF file" error when trying to view the page I'm building.
It had been working fine until I converted my structure data into an array for cleaner coding. I'd alresdy been using an array to draw my lines, so I knw that the use of an array isn't the issue in itself.
I know that this error has to do with headers, but I can't figure out where the issue is developing. How can I go about finding out where the issue is? When I first tested a sample FPFD script I got this error and discovered that I had inadvertently put a couple spaces in front of the <?PHP bracket. It worked fine after removing the spaces.
I experienced some issues with my editor between the time itwas working and when it wasn't. I'm wondering if it's possible that something got corrupted. The document outputs to file without issue - just having trouble displaying the document on the browser.
For what it's worth, here's my code:
Code:
<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/lib/fpdf/fpdf.php';
include_once $_SERVER['DOCUMENT_ROOT'] . '/lib/pe_lib/pe.inc.php';
$pdf=new FPDF();
// front page
$pdf->AddPage();
//draw lines
$fp_lines = array();
$fp_lines = get_fplines();
for ($ctr=0;$ctr<=count($fp_lines);$ctr++ ){
$pdf->Line($fp_lines[$ctr]['x1'], $fp_lines[$ctr]['y1'], $fp_lines[$ctr]['x2'],$fp_lines[$ctr]['y2']);
}
//add boiler plate
$fp_bp=array();
$fp_bp = get_fpbp();
for ($ctr=0;$ctr<=count($fp_bp);$ctr++){
$pdf->SetFont($fp_bp[$ctr]['font'],$fp_bp[$ctr]['font_type'], $fp_bp[$ctr]['font_size']);
$pdf->SetXY($fp_bp[$ctr]['x'], $fp_bp[$ctr]['y']);
$pdf->Write(5,$fp_bp[$ctr]['text']);
}
$pdf->Output($_SERVER['DOCUMENT_ROOT']. '/pdf_docs/test2.pdf',"F");
$pdf->Output();
?>
No comments posted yet
Your Answer:
Login to answer
88 17
Other forums
small inaccuracies
I have this code to convert fractional base 10 into base 2:
while($num > 0)
Unable to retreve the values from Mysql Query
Hi,
Here is the php code that I have, Query is running properly in phpmyadmin and is resu
the problem with str_replace
$str="hahahahahahahahahahahahahaha";
$nn=1;
$str=str_replace('ha','MyGod',$str,$nn);
How do i do multi uploads?.
Hey i would like to do this : http://hosting.mrkrabz.net/
I've got the base down you can uplo
Retrieving Data from Two Different Databases
Hello All,
Ran into another problem and would appreciate some help! I have two datab
writing my own sobel filter convolution - something is wrong
I am trying to keep it very simple, I cant see anything wrong with my logic, could anybody help poin
registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause
Creating XML with php
I need to creat an XML with php and have successfully produced a valid output.
The problem I hav
Local file browser with php
Halo..
So this is what i want to create. I have a folder that i share and it has many movies.
Executing an exe
Hi. I have some bizarre problem with exec (other any other method) to launch exe's. I am making a ga