lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master e7d763d 066/156: Add company logo display to


From: Greg Chicares
Subject: [lmi-commits] [lmi] master e7d763d 066/156: Add company logo display to the PDF illustration header
Date: Tue, 30 Jan 2018 17:22:12 -0500 (EST)

branch: master
commit e7d763d4bab46853a1daf08587d09873dae63b19
Author: Vadim Zeitlin <address@hidden>
Commit: Vadim Zeitlin <address@hidden>

    Add company logo display to the PDF illustration header
    
    This requires associating a wxFileSystem with wxHTML parser used, in
    order to enable loading images during run-time.
---
 header.mustache   | 2 ++
 pdf_writer_wx.cpp | 3 +++
 pdf_writer_wx.hpp | 6 ++++++
 3 files changed, 11 insertions(+)

diff --git a/header.mustache b/header.mustache
index 4ec8747..85d9de8 100644
--- a/header.mustache
+++ b/header.mustache
@@ -1,3 +1,5 @@
+<img src="company_logo.png"></img>
+
 <font size=-1>
 <p align="center">
     {{#IsInforce}}
diff --git a/pdf_writer_wx.cpp b/pdf_writer_wx.cpp
index 6b4ab4d..ebed4ed 100644
--- a/pdf_writer_wx.cpp
+++ b/pdf_writer_wx.cpp
@@ -26,6 +26,7 @@
 #include "alert.hpp"
 #include "html.hpp"
 
+#include <wx/filesys.h>
 #include <wx/html/htmlcell.h>
 
 namespace
@@ -102,6 +103,8 @@ pdf_writer_wx::pdf_writer_wx
             ,"Courier"
             );
         }
+    html_vfs_.reset(new wxFileSystem());
+    html_parser_.SetFS(html_vfs_.get());
 }
 
 /// Output an image at the given scale into the PDF.
diff --git a/pdf_writer_wx.hpp b/pdf_writer_wx.hpp
index 8c683df..4634f7c 100644
--- a/pdf_writer_wx.hpp
+++ b/pdf_writer_wx.hpp
@@ -34,6 +34,8 @@
 #include <array>
 #include <memory>                       // std::unique_ptr
 
+class wxFileSystem;
+
 namespace html { class text; }
 
 class pdf_writer_wx
@@ -86,6 +88,10 @@ class pdf_writer_wx
   private:
     wxPrintData print_data_;
     wxPdfDC pdf_dc_;
+
+    // Order is potentially important here: html_parser_ uses html_vfs_, so
+    // must be declared after it in order to be destroyed before it.
+    std::unique_ptr<wxFileSystem> html_vfs_;
     wxHtmlWinParser html_parser_;
 
     wxSize const total_page_size_;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]