Welcome! Log In Create A New Profile

Advanced

Some things about using convertfile function

Posted by santi900 
Some things about using convertfile function
October 19, 2010 07:03AM
I"ll try to explain.
I have a php site that requires authentification, i have some dinamic pages automatically saved in local files on the server with ob_start... At first i used the converthtml to print this static files and, after putting the css inline the html code, it worked, but not the images was printed.
I "ve tried with the convertfile function instead of converthtml because i understand the second can"t print images (or yes?).
But no images printed with convertfile funtion and css is still inline.

Here is the portion of code related to:

//... other parameters and class correctly working
$client->enableImages(TRUE);  // necesary??
	
	try
	{
	//html working:
	//	header("Content-type: application/pdf");
        //	header("Content-Disposition: attachment; filename="impresion.pdf"");
        //      echo $client->convertHtml($html);
		

	  //convertFile
    	$client->convertFile("C:/wamp/www/srvf/pdf.html", fopen("file.pdf", "wb"));

        //opening this html file on navigator shows as expected, imges, styles... but It builds pdf in the same path without images 

	}


When i active the headers code lines with convertFile it gives an error opening the pdf (not with convertHtml function)
Is it necessary to write the full path of the file?
Any ideas for printing images?
The images are gif format, i suppose they are supported... aren"t them?

Thanks in advance, great work!!

Santiago
Re: Some things about using convertfile function
October 19, 2010 07:37AM
Santiago,

there are two ways how to print images:
  1. If the images are publicly available, use an absolute path in your html:
      <img src="http://yourdomain.com/your-image.gif">  
  2. Or pack the images together with your html code to a zip file and send it using convertFile(). Use a relative path in this case:
      <img src="your-image.gif">  

>> Is it necessary to write the full path of the file?
It does not matter for Pdfcrowd, but you should probably use the full path to be sure that your script can find it.


Does this help?
Re: Some things about using convertfile function
October 19, 2010 07:41AM
Sure, thank you

best regards
Sorry, only registered users may post in this forum.

Click here to login