  var client = invoice.client;
		  var account = invoice.account;
		  var currencyId = client.currency_id;  
		  
      layout.accountTop += 25;
      layout.headerTop += 25;
      layout.tableTop += 25;

		  if (invoice.image)
		  {
		    var left = layout.headerRight - invoice.imageWidth;
		    doc.addImage(invoice.image, 'JPEG', left, 50);
		  } 
		  
		  /* table header */
		  doc.setDrawColor(200,200,200);
		  doc.setFillColor(230,230,230);
		  
		  var detailsHeight = getInvoiceDetailsHeight(invoice, layout);
		  var left = layout.headerLeft - layout.tablePadding;
		  var top = layout.headerTop + detailsHeight - layout.rowHeight - layout.tablePadding;
		  var width = layout.headerRight - layout.headerLeft + (2 * layout.tablePadding);
		  var height = layout.rowHeight + 1;
		  doc.rect(left, top, width, height, 'FD'); 

		  doc.setFontSize(10);
		  doc.setFontType('normal');

		  displayAccount(doc, invoice, layout.marginLeft, layout.accountTop, layout);
		  displayClient(doc, invoice, layout.marginLeft, layout.headerTop, layout);

		  displayInvoice(doc, invoice, layout.headerLeft, layout.headerTop, layout, layout.headerRight);
		  layout.tableTop = Math.max(layout.tableTop, layout.headerTop + detailsHeight + (2 * layout.tablePadding));

		  var headerY = layout.headerTop;
		  var total = 0;

		  doc.setDrawColor(200,200,200);
		  doc.setFillColor(230,230,230);
		  var left = layout.marginLeft - layout.tablePadding;
		  var top = layout.tableTop - layout.tablePadding;
		  var width = layout.headerRight - layout.marginLeft + (2 * layout.tablePadding);
		  var height = layout.rowHeight + 2;
		  doc.rect(left, top, width, height, 'FD');   

		  displayInvoiceHeader(doc, invoice, layout);
		  var y = displayInvoiceItems(doc, invoice, layout);

		  doc.setFontSize(10);

		  displayNotesAndTerms(doc, layout, invoice, y+20);

		  y += displaySubtotals(doc, layout, invoice, y+20, 480) + 20;

		  doc.setDrawColor(200,200,200);
		  doc.setFillColor(230,230,230);
		  
		  var left = layout.footerLeft - layout.tablePadding;
		  var top = y - layout.tablePadding;
		  var width = layout.headerRight - layout.footerLeft + (2 * layout.tablePadding);
		  var height = layout.rowHeight + 2;
		  doc.rect(left, top, width, height, 'FD'); 
		  
		  doc.setFontType('bold');
		  doc.text(layout.footerLeft, y, invoice.is_quote ? invoiceLabels.total : invoiceLabels.balance_due);

		  total = formatMoney(invoice.balance_amount, currencyId);
		  var totalX = layout.headerRight - (doc.getStringUnitWidth(total) * doc.internal.getFontSize());
		  doc.text(totalX, y, total);   

		  if (!invoice.is_pro) {
		    doc.setFontType('normal');
		    doc.text(layout.marginLeft, 790, 'Created by InvoiceNinja.com');
		  }