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
Material Master Update through BAPI - Follow up material not updated
Hi Experts,
I am updating the material master through a custom transaction using the BAPI
Gantt Chart Tool
Does anyone know of a good free gantt chart creator tool
Thanks
How to assign a textbox value to PHP variable??
Hi ! Can any one help me out as quickly as possible. As I m new to PHP.
Plz tell me how to assign
Convert array to string and write to csv file
I am looking to write a MySQL query to a csv file.
At the minute I:
check for the orig
A Few Questions
Hi, I want to ask a few questions that I can't seem to find..
1) I'm creating a "shortcu
connect() succeeds but accept() does not?
Please help me with this problem. I'm working on a time-sensitive project where I'm using TCP socket
set xml path in flash when xml created in memorystream and webrequest
i am creating an xml file using memory stream and i want to load this xml file into the flash on cli
File upload issues
Hi Guys,
Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages
ASP.NET 2.0 - Enter Key - Default Submit Button
Hi,One of the most annoying things in developing web pages is handling the "Enter key" for form subm
pointer 102 question
I read a book
1
2
3
4
5
6
7
8
9
10
11
12
int main()
{