TCPDF not formatting

I'm using an ajax call to print a pdf and email it to user, but the problem is that the data in the pdf is not formatted.

Here's my ajax call

$(document).ready(function() {
$(function() {
    $(".submit").click(function() {
      $('.headerRow div').css({'display':'none'});
       $('.itemRow').css({'position':'absolute'}, {'left':'0px'}, {'top':'50px'});
      $('.item-name').css({'position':'absolute'}, {'left':'50px'}, {'top':'0px'});
      $('item-price').css({'position':'absolute'}, {'left':'150px'}, {'top':'0px'});
      $('.item-total').css({'position':'absolute'}, {'left':'250px'}, {'top':'0px'});
      var data = $('#yhteystiedot').serializeArray();
      data.push( { name: 'cartContent', value: $('#emailedcart').html()});
      //alert (data);return false;
    type: "POST",
    data: data,
    url: "order/order.php",
    dataType: "html",
    error: function(){ alert("Jotakin meni pahasti pieleen! Yritä uudelleen?");
    success: function() {

  return false;


It adds style to the data that is being pushed to the script, but it doesn't look like it should. Here's a screenshot about it:


Sorry, here is the corrected answer.

Use only INLINE CSS to work with TCPDF like;

<table style="width: 100px;" cellspacing="0" cellpadding="0">
    <td style="border: 1px solid #000000; height: 20px; text-align:center; font-weight: bold; font-size: x-large;" colspan=11>

Or wrap inside your code like <style>p{color:red;}</style>

TCPDF has class issues. Send this HTML data using AJAX. Try like this and comment here.

Need Your Help

Mhartl, Chap 9 - User pages, edit page failure

ruby-on-rails ruby rspec

I'm working my way through Michael Hartls RoR tutorial which is my first experience with coding.

migrate model slug field to unique for existing database

python django django-models django-migrations

In old database slug field was not unique, so duplicates are created. Now i want to migrate slug field unique=True.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.