PDF export and strip HTML tags

QuestionsPDF export and strip HTML tags
biowan asked 9 years ago

Hi,

I just renew my license yesterday 🙂
So I configured some information in grid with color with HTML code, when I export it in PDF file, I get visible HTML code in the PDF. Is it possible to do a strip_tags before exportation ?

Thanks for your reply.

4 Answers
Abu Ghufran answered 9 years ago

Here is sample solution code for your case that removes html tags in pdf.

http://hastebin.com/ukiqohixos.php

biowan answered 9 years ago

Thanks for your reply Abu,

I'm not sure to understand. Do you mean to use the function set_pdf_format() ?
There is methods for the pdf format $pdf, but I don't see method for $data.

Thanks for precision.

Abu Ghufran answered 9 years ago

You only need to set following with html tag column.

$col["on_data_display"] = array("display_comp","");

function display_comp($data)
{
if (isset($_GET["export"]))
return $data["company"];
else
return "<font color='red'>".$data["company"]."</font>";
}

If function callback, i've skipped html tags if GET array has export variable.

biowan answered 9 years ago

Ok, it works, but not perfectly.
Maybe I must use the grouping on the field. But it's ok.

Thanks Abu.

Your Answer

15 + 4 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?