summaryrefslogtreecommitdiffstats
path: root/src/pdf-invoice/pdf-invoice.vala
diff options
context:
space:
mode:
authorSebastian Reichel <sre@ring0.de>2013-05-16 19:18:27 +0200
committerSebastian Reichel <sre@ring0.de>2013-05-16 19:18:27 +0200
commit6b7c4b38331ec880a1bc67cf65c5f0c5e9c52add (patch)
tree5ad7107ddf037f7ecaefdb091d7a6cac3363ce00 /src/pdf-invoice/pdf-invoice.vala
parente075f9d8060bb08da46fd2be679e2cc2f226fec1 (diff)
downloadserial-barcode-scanner-6b7c4b38331ec880a1bc67cf65c5f0c5e9c52add.tar.bz2
pdf-invoice: get datapath from config
Diffstat (limited to 'src/pdf-invoice/pdf-invoice.vala')
-rw-r--r--src/pdf-invoice/pdf-invoice.vala11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/pdf-invoice/pdf-invoice.vala b/src/pdf-invoice/pdf-invoice.vala
index 15f40d0..9a09ed9 100644
--- a/src/pdf-invoice/pdf-invoice.vala
+++ b/src/pdf-invoice/pdf-invoice.vala
@@ -43,6 +43,8 @@ public class InvoicePDF {
/* internal helper */
private DateTime previous_tm;
+ private string datadir;
+
private const string[] calendermonths = {
"Januar",
"Februar",
@@ -58,7 +60,8 @@ public class InvoicePDF {
"Dezember"
};
- public InvoicePDF() {
+ public InvoicePDF(string datadir) {
+ this.datadir = datadir;
}
private void render_svg(Cairo.Context ctx, string file) {
@@ -74,14 +77,14 @@ public class InvoicePDF {
ctx.save();
ctx.translate(-20, 818);
ctx.scale(1.42, 1.42);
- render_svg(ctx, "../../invoice/footer-line.svg");
+ render_svg(ctx, datadir + "/footer-line.svg");
ctx.restore();
}
private void draw_logo(Cairo.Context ctx) {
ctx.save();
ctx.translate(366,25);
- render_svg(ctx, "../../invoice/logo.svg");
+ render_svg(ctx, datadir + "/logo.svg");
ctx.restore();
}
@@ -355,7 +358,7 @@ public class InvoicePDF {
/* load text template */
try {
var text = "";
- FileUtils.get_contents("template.txt", out text);
+ FileUtils.get_contents(datadir + "/pdf-template.txt", out text);
text = text.replace("{{{ADDRESS}}}", address);
text = text.replace("{{{LASTNAME}}}", invoice_recipient.lastname);
text = text.replace("{{{SUM}}}", @"$sum");