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

Firefox plugin crashes in Chrome

c++ google-chrome npapi

From what I gather, Google Chrome can run browser plugins written using NPAPI.

ZipArchive creates invalid ZIP file

c# .net windows-8

I am trying to create a new ZIP package from code with one entry and save the ZIP package to a file. I am trying to achive this with the System.IO.Compression.ZipArchive class. I am creating the ZIP

java.util.Timer or a While loop in a SwingWorker thread?

java multithreading timer while-loop swingworker

In another question I posted recently I was suggested to use a java.util.Timer in the SwingWorker instead of a while loop. The tasks in the SwingWorker are supposed to run every 10 seconds.