Note that there are some explanatory texts on larger screens.

plurals
  1. POWriting PDF using PHP (PDFLib)
    primarykey
    data
    text
    <p>I'm currently writing a code to output a pdf file in PHP using PDFlib from <a href="http://www.pdflib.com/" rel="nofollow noreferrer">http://www.pdflib.com/</a>. The problem is all html tag is also written in the output file. How can be able to cancel out all those tags?</p> <p>Here is my sample code.</p> <pre><code>$postVariable = $_POST; $contentData = ""; foreach($postVariable as $key =&gt; $value){ if(is_array($key)){ foreach($key as $key1 =&gt; $value1){ $contentData.= $key1 .": ". $value1."&lt;nextline&gt;"; } }else{ $contentData.= $key .": ". $value."&lt;nextline&gt;"; } } $testdata = nl2br($contentData); $pdf = pdf_new(); // open a file pdf_open_file($pdf, $_SERVER['DOCUMENT_ROOT']."cas".DIRECTORY_SEPARATOR."$filename.pdf"); // start a new page (A4) pdf_begin_page($pdf, 595, 842); // Locate Font Directory $fontdir = "C:\WINDOWS\Fonts"; // Font Name Parameters pdf_set_parameter($pdf, "FontOutline", "arialMyName=$fontdir\arial.ttf"); // Find Font $arial = PDF_findfont($pdf,"arialMyName","host",0 ); // Set font size and font name pdf_setfont($pdf, $arial, 10); //$arial = pdf_findfont($pdf, "Arial", "host", 1); //pdf_setfont($pdf, $arial, 10); // print text pdf_show_xy($pdf, "TO THE UNIT OWNER",50, 750); pdf_show_xy($pdf, "Test ext", 50,730); pdf_show_xy($pdf, "test test", 50,715); pdf_show_xy($pdf, $contentData, 50,700); // end page pdf_end_page($pdf); // close and save file pdf_close($pdf); </code></pre> <p>and the sample output is: TO THE UNIT OWNER Test text test test type: Apartment****var_name: ****var_company: ****var_date: ****submit: Save and Download&lt;</p> <p>It disregards the html tags and it include it on the content.</p> <p>Is there any other methods on how to print out HTML to PDF using the library that I'm currently using (PDFlib).</p> <p>Thanks.</p> <p>regards, Resty</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload