pc4p-users Mailing List for PC4P - PDF Class for PHP
Status: Inactive
Brought to you by:
eru
You can subscribe to this list here.
| 2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(2) |
Dec
(1) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2002 |
Jan
(9) |
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2003 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: Jens S. <Jen...@we...> - 2003-03-06 13:25:26
|
Hello, I'm new to PC4P and creating PDFs on the fly. I try to set the height of objects, but I don't find a method to do this. Is it even possible to set the height or is it defined by the content of the object? For example: I try to draw tickets. There shoud be 3 on every page. At the moment I build a table with 2 cells, The first cell ist a kind of a blind image to set the height. I don't like this method very much, may be there is a better one. Thanks in advance, Jens ______________________________________________________________________________ 160 Zeichen sind fur Ihre SMS zu wenig? Bei WEB.DE FreeMail koennen Sie bis 760 Zeichen versenden! http://freemail.web.de/features/?mc=021183 |
|
From: Alexander W. <wi...@we...> - 2002-05-29 20:14:14
|
Woops, the mail was only send to Jason ;-) -------- Original Message -------- Subject: Re: [PC4P-users] Saving to file Date: Wed, 29 May 2002 18:56:02 +0200 From: Alexander Wirtz <wi...@we...> Organization: Systematics Integrations GmbH To: Jason Wong <pc...@gr...> References: <200...@gr...> Hey Jason, thanks for the effort, but I already implemented a save-to-disk in the CVS ;-) I really appreciate your help though!! Kind regards, Alexander |
|
From: Jason W. <pc...@gr...> - 2002-05-29 15:23:31
|
Hi
I've made some minor changes which allows pc4p to save the generated PDF to a
file. Maybe someone will find this useful.
pc4p_main.inc
===============================================
function pc4p_draw($outfile="")
{
$start = explode( " ", microtime() );
$this->pc4p_draw_children();
$end = explode( " ", microtime() );
if ( !defined( "PC4PDEBUG" ) ) {
pdf_close( $this->pdfp );
$pdfdata = pdf_get_buffer( $this->pdfp );
if ($outfile) {
ob_start();
echo $pdfdata;
$BODY = ob_get_contents();
ob_end_clean();
fwrite(fopen($outfile, 'w'), $BODY); }
else {
header( "Content-Type: application/pdf" );
header( "Content-Disposition: inline; filename=acrobat.pdf" );
header( "Content-Length: ".strlen( $pdfdata ) );
echo $pdfdata;
}
} else {
echo "<PRE>\n";
var_dump( $this );
$time = ( (float) $end[ 0 ] + (float) $end[ 1 ] ) - ( (float) $start[ 0
] + (float) $start[ 1 ] );
echo "\nProcessing-time: ".number_format( $time, 4 )."s\n";
echo "</PRE>\n";
pdf_close( $this->pdfp );
pdf_get_buffer( $this->pdfp );
}
pdf_delete( $this->pdfp );
}
===============================================
have fun
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
A can of ASPARAGUS, 73 pigeons, some LIVE ammo, and a FROZEN DAQUIRI!!
*/
|
|
From: Alexander W. <wi...@we...> - 2002-05-15 10:12:16
|
Hey Eric, er...@ch... wrote: > As you can see, it is very primitive, it uses a static variable to hold the > page. Dont try to use it outside the page header. > > Suggestions/corrections,etc are welcome. Absolutely fabulous, I'd have never thought of solving it this way, my train of thought was way to complicated for this. I just implemented it, you just have to adjust the pc4p_init.inc, so that a "create pagenumber" does a require_once( "pc4p_text.inc" ); otherwise it fails, when no text was created yet. What I was thinking about, was a simple text-replacement in pc4p_text, but I wasn't aware, that static variables handle that way in class-methods. Well, until someone complains, this will be the "official" way to get pagenumbers. Huge "Assist" to Eric for this one ;-) Thanks & regards, Alexander -- |Alexander Wirtz | http://www.systematics.com/ | |Systematics INTEGRATIONS GmbH | fon +49 2241 39778-60 | |Rathausallee 10 | fax +49 2241 39778-77 | |53757 St. Augustin | mailto:wi...@we... | |
|
From: <er...@ch...> - 2002-05-15 03:54:54
|
Hi all
I've trying to implement page numbers in the headers. I created a new class:
<?php
class pc4p_pagenumber extends pc4p_text
{
function pc4p_pagenumber(&$parent)
{
pc4p_text::pc4p_text($parent);
}
function pc4p_draw()
{
static $count = 0;
$count++;
pc4p_text::pc4p_set_text($count);
pc4p_text::pc4p_draw();
}
}
?>
Then i added some lines in pc4p_init.inc:pc4p_create_object to create the
corresponding objects:
case "pagenumber" :
require_once("pc4p_pagenumber.inc");
$object = &new pc4p_pagenumber($parent);
break;
I can use this new class when setting the page header, with something like:
pc4p_create_object($sometable->cell["i"]["j"], "pagenumber");
As you can see, it is very primitive, it uses a static variable to hold the
page. Dont try to use it outside the page header.
Suggestions/corrections,etc are welcome.
Eric.
|
|
From: Jason W. <pc...@gr...> - 2002-01-10 16:33:38
|
On Thursday 10 January 2002 17:34, Alexander Wirtz wrote: > Hi Jason, > > >I've been trying to use pc4p_set_compression() without success. Looking at > >the source code for pc4p_main.inc I found that pc4p_set_compression > > contains a bug: > > Whoops, yes you're right...I fixed it in the CVS for now. Strangely you're > the first to complain, apparently noone ever used this function or simply > gave up on encountering that error. They've probably been feeding in invalid compression factors such as -4 and 21 , which will set the compression to 1 and 9 respectively in your original code :) > Quote from the manual: > "The PDF output will be compressed with the Flate (also known as ZIP) > compression algorithm. Compression can also be deactivated. Compression > applies to potentially large items, such as raster image data and file > attachments, as well as text and vector operators on page descriptions. > The compression speed/output size trade-off can be controlled with a > PDFlib parameter." > 0 is no compression, 1 is best speed, 9 is best compression. > The manual gives no clue to the question, what the default is...hm According to the comments in your source code the "PDFs with versionnumber > 4 can have a compression-factor". But I couldn't find anything in the pc4p code which specifically sets the PDF version. The PDFLib manual says pdf_set_parameter(PDF*p, "compatibility", "x"), where x is 1.2, 1.3 or 1.4. As I'm not sure where I can put this I added to pc4p_main() the line: pdf_set_parameter($this->pdfp, "compatibility", "1.4"); But when I run it, I get this error: PHP Fatal error: PDFlib error: Can't set parameter 'compatibility' in 'document' scope in /usr/local/apache/www/www.xerox.com/html/library/pc4p_main.inc on line 61 Any idea where/how I can set the PDF version? regards -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* Whereof one cannot speak, thereof one must be silent. -- Wittgenstein */ |
|
From: mike w. <mi...@nu...> - 2002-01-10 11:03:52
|
Hi Alexander, I will have a closer look through the site, thanks, Mike. On Thu, 10 Jan 2002, Alexander Wirtz wrote: > Hi there, > > >On Wednesday 09 January 2002 00:58, mike wolman wrote: > > > >> Is there a simple way to setup a page header and footer, > >> allowing the body of the document to spread across numberous pages > >> depending upon how much info there is? > No, not yet, but if you take a closer look at the Tracker at sourceforge.net > you can see, that it is on my ToDo-list. > > >Mike, if you do work this out please let me know as I need to do something > >similar as well! > > > >BTW this list seems uneerily quiet. > Well, maybe this is because there are only six people subscribed? :-) > > Regards, > Alexander > > |
|
From: Jason W. <pc...@gr...> - 2002-01-10 10:20:10
|
On Thursday 10 January 2002 17:29, Alexander Wirtz wrote: > Hi there, > > >On Wednesday 09 January 2002 00:58, mike wolman wrote: > >> Is there a simple way to setup a page header and footer, > >> allowing the body of the document to spread across numberous pages > >> depending upon how much info there is? > > No, not yet, but if you take a closer look at the Tracker at > sourceforge.net you can see, that it is on my ToDo-list. Excellent. > >BTW this list seems uneerily quiet. > > Well, maybe this is because there are only six people subscribed? :-) What is the best way to get support for pc4p? Is it thru this list or thru the forums on SourceForge? FWIW I much prefer a list to a web-based forum. It's a waste of time having visit each forum several times a day to see whether there are any new posts :) regards -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* My advice to you, my violent friend, is to seek out gold and sit on it. -- The Dragon to Grendel, in John Gardner's "Grendel" */ |
|
From: Jason W. <pc...@gr...> - 2002-01-10 10:17:04
|
Have a bunch of image files that I would like to use with pc4p_set_image().
Unfortunately they don't have an extension (no .jpg, .tif etc).
The present implementation of pc4p_set_image() does not cater for and dies
with "this imagefiletype is not supported".
I have modified the code so that if an extension is not present
getimagesize() is called to find out the image type.
Here's the code:
function pc4p_set_image( $image )
{
// Check, if we have a resource, or a string as filename
if( is_resource( $image ) ) {
// It is a resource, now check, if it's an image-resource
if( imagesx( $image ) > 0 || imagesy( $image ) > 0 ) {
// Jep, so be it!
$this->imgfile = $image;
}
else {
die( "Error: ".get_class( $this )." - the resource of this image is
not valid!" );
}
}
else {
// It's a filename, check for existence
if ( file_exists( $image ) ) {
// It's a filename, check for correct and supported image-type
$imgtype = strtolower( substr( strrchr( $image, "." ), 1 ) );
// If filename contains an extension check that it is a supported one
if ($imgtype) {
switch ( $imgtype ) {
case "png" : $this->imgtype = "png";
break;
case "gif" : $this->imgtype = "gif";
break;
case "tiff" :
case "tif" : $this->imgtype = "tiff";
break;
case "jpeg" :
case "jpg" : $this->imgtype = "jpeg";
break;
#default: die( "Error: ".get_class( $this )." - this
imagefiletype is not supported: ".$imgtype );
}
}
// If filename doesn't have an extension or it's not a supported one
then
// check image type using getimagesize()
if (!$this->imgtype) {
$imgtype = getimagesize($image);
$imgtype = $imgtype[2];
switch ( $imgtype ) {
case "1" : $this->imgtype = "gif";
break;
case "2" : $this->imgtype = "jpeg";
break;
case "3" : $this->imgtype = "png";
break;
}
}
// If $this->imgtype is still empty at this stage the filename is
probably not a supported image type
if (!$this->imgtype) { die( "Error: ".get_class( $this )." - this
imagefiletype is not supported: ".$imgtype ); }
// If we're still here the image is probably valid
$this->imgfile = $image;
}
else {
die( "Error: ".get_class( $this )." - image not found: ".$image );
}
}
}
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
Last night I met upon the stair
A little man who wasn't there.
He wasn't there again today.
Gee how I wish he'd go away!
*/
|
|
From: <wi...@we...> - 2002-01-10 09:34:58
|
Hi Jason, >I've been trying to use pc4p_set_compression() without success. Looking at >the source code for pc4p_main.inc I found that pc4p_set_compression contains >a bug: Whoops, yes you're right...I fixed it in the CVS for now. Strangely you're the first to complain, apparently noone ever used this function or simply gave up on encountering that error. (and also it is obvious, that I never really tested the function *blush*) >Incidentally what is the purpose of the compression factor? And what is the >default? I have set it to 9, but the size of the PDF that I'm getting is the >same as if I hadn't set the compression. However If I view the file in Adobe >Acrobat then do a "Save As..." it results in a file that is 1/10th of the >original size (from 4MB to 400KB). Quote from the manual: "The PDF output will be compressed with the Flate (also known as ZIP) compression algorithm. Compression can also be deactivated. Compression applies to potentially large items, such as raster image data and file attachments, as well as text and vector operators on page descriptions. The compression speed/output size trade-off can be controlled with a PDFlib parameter." 0 is no compression, 1 is best speed, 9 is best compression. The manual gives no clue to the question, what the default is...hm Regards, Alexander -- | Alexander Wirtz | eMail: wi...@we... | | Systematics INTEGRATIONS GmbH | WWW: http://www.web-active.com/ | |
|
From: <wi...@we...> - 2002-01-10 09:30:00
|
Hi there, >On Wednesday 09 January 2002 00:58, mike wolman wrote: > >> Is there a simple way to setup a page header and footer, >> allowing the body of the document to spread across numberous pages >> depending upon how much info there is? No, not yet, but if you take a closer look at the Tracker at sourceforge.net you can see, that it is on my ToDo-list. >Mike, if you do work this out please let me know as I need to do something >similar as well! > >BTW this list seems uneerily quiet. Well, maybe this is because there are only six people subscribed? :-) Regards, Alexander -- | Alexander Wirtz | eMail: wi...@we... | | Systematics INTEGRATIONS GmbH | WWW: http://www.web-active.com/ | |
|
From: Jason W. <jas...@gr...> - 2002-01-10 09:10:26
|
On Wednesday 09 January 2002 00:58, mike wolman wrote: > Is there a simple way to setup a page header and footer, > allowing the body of the document to spread across numberous pages > depending upon how much info there is? Mike, if you do work this out please let me know as I need to do something similar as well! BTW this list seems uneerily quiet. cheers -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* I used to think that the brain was the most wonderful organ in my body. Then I realized who was telling me this. -- Emo Phillips */ |
|
From: mike w. <mi...@nu...> - 2002-01-08 15:47:27
|
Hi, Is there a simple way to setup a page header and footer, allowing the body of the document to spread across numberous pages depending upon how much info there is? Mike. |
|
From: Jason W. <pc...@gr...> - 2002-01-08 03:06:53
|
I've been trying to use pc4p_set_compression() without success. Looking at
the source code for pc4p_main.inc I found that pc4p_set_compression contains
a bug:
------------------------------------------------------------------------
function pc4p_set_compression( $compress )
{
if( $compress < 0 ) {
$compress = 0;
}
elseif( $compress > 9 ) {
$compress = 9;
}
else {
die("Error: ".get_class( $this )." - ".$compress." is not a valid
compression-factor");
}
pdf_set_value( $this->pdfp, "compress", $compress );
}
------------------------------------------------------------------------
As it stands pdf_set_value() never gets called!
I have rewritten it as:
function pc4p_set_compression($compress) {
if (is_integer($compress)) {
if ($compress < 0) {
$compress = 0; }
else {
if ($compress > 9) {
$compress = 9;
}}
pdf_set_value($this->pdfp, "compress", $compress); }
else {
die("Error: ".get_class($this)." - ".$compress." is not a valid
compression-factor");
}
}
Incidentally what is the purpose of the compression factor? And what is the
default? I have set it to 9, but the size of the PDF that I'm getting is the
same as if I hadn't set the compression. However If I view the file in Adobe
Acrobat then do a "Save As..." it results in a file that is 1/10th of the
original size (from 4MB to 400KB).
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
You are wise, witty, and wonderful, but you spend too much time reading
this sort of trash.
*/
|
|
From: petes <pe...@ip...> - 2001-12-05 21:48:25
|
I'm trying to create a table that for each row has a table with multiple rows. here is the sample of code for table 2. $table2 = &pc4p_create_object( $table1->cell[0][$i], "table" ); My question is, Is there a way to have the second table be wider than just one column? example: table1 has 5 columns - row1--------------- table2 row#-------------- table1 row--------------- I'm kind of doing it now but table 2 is limited to the width of table 1 column 1. So it is kind of crunched. Thanks for any help you can give. Pete |
|
From: Alexander W. <wi...@we...> - 2001-11-30 10:48:41
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Earl, On Sunday 25 November 2001 12:39, Earl Claus wrote: > I'm using Win2K with IIS and php 4.06. <snip> > Is this header info correct? I'm not convinced that my browser is > receiving the correct document header info. The header is correct, I tested this with various browsers and different versions. There were a few problems reported on the PDFlib-Mailinglist, which stated difficulties with the IE 5.x and 6.x. and maybe this is due to the new PlugIn-System Microsoft introduced lately. I'm keeping an eye on this, but I can reassure you, that this strangeness has nothing to do with the headers ;-) Best regards and thanks for your report, Alexander - -- | Alexander Wirtz | eMail: wi...@we... | | web@ctive GmbH | "Accidents, Emergency, Ambulance" | -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8B2PdDTqTaMH1weIRAj51AJ92/QoVCnvIU43zvDL6+xgheMyuoACcCOuY q46HpSjZh2Nd5Br5ZRbRM2M= =5Iqu -----END PGP SIGNATURE----- |
|
From: <sa...@ea...> - 2001-11-25 20:28:51
|
I'm using Win2K with IIS and php 4.06. It looks like the pdf is generating, but it does not appear correctly in my IE 5.01 browser. It looks like a buch on scrambled text. I noticed this in your code: header( "Content-Type: application/pdf" ); header( "Content-Disposition: inline; filename=acrobat.pdf" ); header( "Content-Length: ".strlen( $pdfdata ) ); Is this header info correct? I'm not convinced that my browser is receiving the correct document header info. Please help. Earl Claus Web Master |