Jump to content

Recommended Posts

Hi,

Two weeks ago I started to search HTML -> PDF Converter in PHP.

I found FPDF and, which's very good, and now I'm really close to success, but i need a function which return a compiled HTML code. Here's my code:

<?php

include("create_text_html.php"); //Create products_mysql.html. Dont watch this it's ok

define('FPDF_FONTPATH','font/'); //In the whole internet this define is required to work the class fine

require('fpdf.php'); //Dont have to explain this

$pdf=new FPDF(); //This too

$pdf->AddFont('Verdana','','verdana.php'); //This is a function in the class and I need to add it if i want to use definite font (In my case a cyrillic Verdana)

$pdf->AddPage(); //Starts creation of new PDF doc

$pdf->SetFont('Verdana','',15); //Sets the font mationed up

$file_name = !!!ATTENTION!!!"products_mysql.html"; //A little explaining in next rows

$pdf->Cell(0,10,$file_name); //This Writes the variable

$pdf->Output('test.pdf', 'F'); //And this saves the PDF

?>

 

OK. Everything works fine except the !!!ATTENTION!!! row. My Q is which PHP function to use to return a compiled, executed(or something like this) html file.

I try with file_get contents(), but nothing. In PDF it wrote this: http://img12.imageshack.us/img12/3962/28079502.png

With file() it wrote Array(like text)

I dont know which function to use. Plese help me.

Thank u in advance.

Link to comment
https://forums.phpfreaks.com/topic/155700-return-compiledor-something-html-code/
Share on other sites

1-st By Compiled I mean executed. I have a html file and when i file_get_contents() it, in PDF is written text(<html><head... like on the pic). I need a function which returns me a content of this HTML like in browser. I hope u understood me

 

2-nd Im sure that FPDF renders HTML, because i saw it but in latin. Function WriteHTML writes HTML only in latin. I need a cyrillic

 

Damn you, you're not supposed to look more into it than me! ;)

But those scripts are actually extensions, right? So in a strict sense I was right.

 

ORLY? Yes, really.

:P

I wonder why so many people have problems enabling it then :P

 

Noobs. It's there.

 

@ ABPAM

You will have to rely on whatever custom functions you can find that parses HTML into PDF content. A Google search shows quite a few alternatives to FPDF: http://www.google.com/search?hl=en&q=html+2+pdf+php&btnG=Search

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.