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

Fix for pdfmake watermark

This commit is contained in:
Hillel Coren 2016-10-26 12:44:04 +03:00
parent 14352741be
commit 4a94633add
5 changed files with 13 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -114,6 +114,8 @@ function GetPdfMake(invoice, javascript, callback) {
// set page size
dd.pageSize = invoice.account.page_size;
// dd.watermark = 'PAID';
pdfMake.fonts = {}
fonts = window.invoiceFonts || invoice.invoice_fonts;

View File

@ -466,7 +466,7 @@
var watermark = page.watermark;
pdfKitDoc.fill('black');
pdfKitDoc.opacity(0.6);
pdfKitDoc.opacity(0.1);
pdfKitDoc.save();
pdfKitDoc.transform(1, 0, 0, -1, 0, pdfKitDoc.page.height);
@ -477,8 +477,13 @@
var encoded = watermark.font.encode(watermark.text);
pdfKitDoc.addContent('BT');
pdfKitDoc.addContent('' + (pdfKitDoc.page.width/2 - watermark.size.size.width/2) + ' ' + (pdfKitDoc.page.height/2 - watermark.size.size.height/4) + ' Td');
pdfKitDoc.addContent('/' + encoded.fontId + ' ' + watermark.size.fontSize + ' Tf');
pdfKitDoc.addContent('<' + encoded.encodedText + '> Tj');
// http://stackoverflow.com/a/32658671
//pdfKitDoc.addContent('/' + encoded.fontId + ' ' + watermark.size.fontSize + ' Tf');
//pdfKitDoc.addContent('<' + encoded.encodedText + '> Tj');
pdfKitDoc.addContent('/ ' + watermark.size.fontSize + ' Tf');
pdfKitDoc.addContent('(' + watermark.text + ') Tj');
pdfKitDoc.addContent('ET');
pdfKitDoc.restore();
}