1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 12:12:48 +01:00

Working on pdfmake

This commit is contained in:
Hillel Coren 2015-04-21 14:42:31 +03:00
parent 6d651a250c
commit 8018bcad6c
10 changed files with 40 additions and 17 deletions

View File

@ -58,7 +58,7 @@ module.exports = function(grunt) {
'public/vendor/jspdf/dist/jspdf.min.js',
//'public/vendor/handsontable/dist/jquery.handsontable.full.min.js',
'public/vendor/pdfmake/build/pdfmake.min.js',
'public/vendor/pdfmake/build/vfs_fonts.js',
//'public/vendor/pdfmake/build/vfs_fonts.js',
//'public/js/vfs_fonts.js',
'public/js/lightbox.min.js',
'public/js/bootstrap-combobox.js',

View File

@ -292,6 +292,7 @@ class AccountController extends BaseController
$account->share_counter = Input::get('share_counter') ? true : false;
$account->pdf_email_attachment = Input::get('pdf_email_attachment') ? true : false;
$account->utf8_invoices = Input::get('utf8_invoices') ? true : false;
if (!$account->share_counter) {
$account->quote_number_counter = Input::get('quote_number_counter');

View File

@ -11,12 +11,10 @@ class InvoiceDesign extends Eloquent
{
$designs = $query->where('id', '<=', \Auth::user()->maxInvoiceDesignId())->orderBy('id')->get();
foreach ($designs as $design) {
if ($design->filename) {
$fileName = public_path(strtolower("js/templates/{$design->name}.js"));
if (Auth::user()->account->utf8_invoices && file_exists($fileName)) {
$design->javascript = file_get_contents($fileName);
}
foreach ($designs as $design) {
$fileName = public_path(strtolower("js/templates/{$design->name}.js"));
if (Auth::user()->account->utf8_invoices && file_exists($fileName)) {
$design->javascript = file_get_contents($fileName);
}
}

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,15 @@
function GetPdfMake(invoice, javascript, callback) {
var account = invoice.account;
eval(javascript);
var fonts = {
Roboto: {
normal: 'Roboto-Regular.ttf',
bold: 'Roboto-Medium.ttf',
italics: 'Roboto-Italic.ttf',
bolditalics: 'Roboto-Italic.ttf'
}
};
doc = pdfMake.createPdf(dd);
doc.save = function(fileName) {
this.download(fileName);

View File

@ -116,7 +116,7 @@ var dd = {
},
defaultStyle: {
//font: 'sans'
//font: 'Roboto',
fontSize: 9,
margin: [8, 4, 8, 4]
},

File diff suppressed because one or more lines are too long

View File

@ -596,5 +596,8 @@ return array(
'more_fields' => 'More Fields',
'less_fields' => 'Less Fields',
'client_name' => 'Client Name',
'pdf_settings' => 'PDFF Settings',
'utf8_invoices' => 'UTF-8 Support <sup>Beta</sup>',
);

View File

@ -4,7 +4,7 @@
@parent
<style type="text/css">
div.checkbox {
.input-group-addon div.checkbox {
display: inline;
}
span.input-group-addon {
@ -18,10 +18,12 @@
@include('accounts.nav_advanced')
{!! Former::open()->addClass('warn-on-exit') !!}
{!! Former::populate($account) !!}
{!! Former::populateField('custom_invoice_taxes1', intval($account->custom_invoice_taxes1)) !!}
{!! Former::populateField('custom_invoice_taxes2', intval($account->custom_invoice_taxes2)) !!}
{!! Former::populateField('share_counter', intval($account->share_counter)) !!}
{{ Former::populate($account) }}
{{ Former::populateField('custom_invoice_taxes1', intval($account->custom_invoice_taxes1)) }}
{{ Former::populateField('custom_invoice_taxes2', intval($account->custom_invoice_taxes2)) }}
{{ Former::populateField('share_counter', intval($account->share_counter)) }}
{{ Former::populateField('pdf_email_attachment', intval($account->pdf_email_attachment)) }}
{{ Former::populateField('utf8_invoices', intval($account->utf8_invoices)) }}
<div class="row">
<div class="col-md-6">
@ -94,7 +96,8 @@
<h3 class="panel-title">{!! trans('texts.email_settings') !!}</h3>
</div>
<div class="panel-body">
{!! Former::checkbox('pdf_email_attachment') !!}
{!! Former::checkbox('pdf_email_attachment')->text(trans('texts.enable')) !!}
{!! Former::checkbox('utf8_invoices')->text(trans('texts.enable')) !!}
</div>
</div>
</div>

View File

@ -23,7 +23,8 @@
<link href="{{ asset('favicon.png') }}" rel="shortcut icon">
<link rel="canonical" href="{{ NINJA_APP_URL }}/{{ Request::path() }}" />
<script src="{{ asset('js/built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<script src="{{ asset('js/built.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<script src="{{ asset('js/vfs_fonts.js') }}?no_cache={{ NINJA_VERSION }}" type="text/javascript"></script>
<script type="text/javascript">
var NINJA = NINJA || {};