PHP-GTK2 Cookbook Forum
Welcome, Guest
Please Login or Register.    Lost Password?
Re:FPDF Merge error Joomla 1.5 article, works alone. (1 viewing) (1) Guest
Go to bottom Post Reply Favoured: 0
TOPIC: Re:FPDF Merge error Joomla 1.5 article, works alone.


#4591
PeteTev (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
FPDF Merge error Joomla 1.5 article, works alone. 2 Years, 10 Months ago Karma: 0  
Hi,

1st post, patience please.

I am attempting to utilize the Form Filling script from this link: http://www.fpdf.org/en/script/script93.php
to create a PDF of current users data from my database "merged" with a template PDF file.

I have installed the files, including the template PDF from the zip download onto my server and the example script runs works correctly when saved as a php file on my server. I get a new PDF with the array data merged into it.

When I try to embed the very same code into an article in Joomla after installing and enabling the DirectPHP plugin, it gives this error (before the Output even get to occur), then hangs:

FPDF-Merge Error: extract_pdf_definition_value() does not support definition '/Type'

If I comment out this merge line:
Code:
$pdf->Merge();
it processes properly and finishes, the new PDF file looks just like the template, but with blanks, no data merged. Text from the error above is in the required fpdm.php file so I know it is being found/called/is running. Any ideas what is the difference between running from a file at the root and in a Joomla article? Can I maybe comment out the code causing this error? Thank you in advance for any advice! I'm running Joomla 1.5.22 Stable, DirectPHP v1.56, No editor. PHP Version: 5.2.13 on Linux server. PS. I have asked same question in the forum on fpdf.org. If I find answer, I'll gladly reply here and post a tip under DirectPHP section.
 
  The administrator has disabled public write access.

#4596
kksou (Admin)
Admin
Posts: 1700
graph
User Online Now Click here to see the profile of this user
Re:FPDF Merge error Joomla 1.5 article, works alone. 2 Years, 9 Months ago Karma: 27  
Hi,

I wrote DirectPHP with the original intention to allow easy embedding of PHP commands within a Joomla article. I thought this might be useful to others, that's why I decide to share this with the rest in joomla.org.

Being a plugin, it's for use within an article. By the time joomla runs your PHP script, the HTML header and joomla framework has already been loaded. What this means is that many PHP scripts that require the output of HTML header will not work within a Joomla article using DirectPHP.

I'm not familiar with your script. I'm not sure if it outputs any HTML header (in which case your script will definitely not work). However, a script that generates PHP is usually a complicated one (which might have some conflicts with the Joomla framework). So it will not be too surprising if the script doesn't work.

Since you are using DirectPHP, most likely you already know PHP. I would really encourage you to write a Joomla native plugin or component for your purpose. It's not that tough, there are now many books out there that teaches how to write a Joomla plugin.

With your own native plugin, you will be able to load your PHP scripts directly, instead of going through another layer of DirectPHP. It's still not guaranteed to work (since it's not run directly but within the Joomla framework), but the probability of successfully running it is much higher.

Regards,
/kksou
 
 
Last Edit: 2011/06/27 23:52 By kksou.
  The administrator has disabled public write access.

#5585
sank123 (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Re:FPDF Merge error Joomla 1.5 article, works alone. 1 Year, 6 Months ago Karma: 0  
I know that this is old, and you probably won't see this/need this by now - but, I figured I'd help out with others who had the same issue.


Joomla doesn't play well with the global variables $FPDM_FILTERS and $FPDM_REGEXPS.

Change lines 35-39 of fpdm.php:

Code:
global $FPDM_FILTERS;
$FPDM_FILTERS =array(); //holds all supported filters
global $FPDM_REGEXPS;
$FPDM_REGEXPS= array(
	"/Type"=>"/\/Type\s+\/(\w+)$/",
	"/Subtype" =>"/^\/Subtype\s+\/(\w+)$/"
);
 
 
Last Edit: 2012/10/15 01:55 By sank123.
  The administrator has disabled public write access.
#5977
Abigail111 (User)
Fresh Boarder
Posts: 2
graphgraph
User Offline Click here to see the profile of this user
Re:FPDF Merge error Joomla 1.5 article, works alone. 7 Months, 3 Weeks ago Karma: 0  
I'm not really understand you .But you can try to this demo code to merge pdf:
using RasterEdge.Imaging.Basic;
using RasterEdge.Imaging.Basic.Core;
using RasterEdge.Imaging.Basic.Codec;
using RasterEdge.Imaging.PDF;


namespace RE__Test
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

public static string FolderName = "c:/";

private void button1_Click(object sender, EventArgs e)
{
string fileName1 = FolderName + "Sample1.pdf";
string fileName2 = FolderName + "Sample2.pdf";
string fileNameMerged = FolderName + "Merged.pdf";

REDocument doc1 = REFile.OpenDocumentFile(fileName1, new PDFDecoder());//use PDFDecoder open one pdf file

REDocument doc2 = REFile.OpenDocumentFile(fileName2, new PDFDecoder());//use PDFDecoder open another pdf file

BaseDocument docMerged = doc1.MergeDocument(doc2);//merge two pdf

REFile.SaveDocumentFile((REDocument)docMerged, fileNameMerged, new PDFEncoder());//save new pdf

}

}
 
  The administrator has disabled public write access.
#6013
fishigon (User)
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Add the remaining ingredients 5 Months, 3 Weeks ago Karma: 0  
Add the remaining ingredients and gently bring a few to true a silent boil .
 
  The administrator has disabled public write access.



Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop

Blog - Forum - Privacy Policy - Contact Us
Copyright © 2006-2012. kksou.com. All Rights Reserved