Here's the code to load it:
Once we retrieve the email, in addition to storing the body of the email, we’ll also want the subject, from, to and other relevant information for the email. We’ll create an html document with HtmlAgilityPack to hold all this info.
We’ll start with a skeleton html document structure loaded from an html string as this is far easier than creating each node of the html document by hand.
Then once that is created we’ll grab some references to the head and body nodes so we can add our content. I use the AppendField helper method which just creates a little html structure with a label and it’s text like so:
Then we’ll load up the body html (or plain text possibly) into its own document, to prepare for copying it into the document that we’re creating. We’ll add a Body label to put the contents of the email body into the document.
To get the document to look as much like the original as possible we copy the styles from the head tag of the email body to the head tag in our document.
Once we’ve done that we create a div tag to hold the html body of the email and copy it in.
Once we have the email loaded and an html document generated from the email, then we save HtmlDocument to a string to prepare for converting to pdf. We pass the html string to HtmlGenerator and it gets saved to a pdf.
The resulting pdf file looks like this:
Last month Leaf’s Cloud Services team headed up to Chicago for the AWS Summit. Amazon Web Services holds these free summits in many cities around the world. They are a great opportunity for beginners and experienced users alike to network and learn more about the platform. They even provide the chance to take certification exams (which reminded us that we need to keep our Solutions Architect certifications up to date!).
This year it was clear that microservices are taking over. The longest lines were for sessions detailing how to run microservices on Docker or on how to implement them with Serverless techniques using AWS Lambda. The concept of breaking larger applications into smaller services is not new, but with the public descriptions of Service Oriented Architectures like those of AWS and Netflix, it is widely used. We're particularly interested in the organizational benefits of assigning small teams to building and supporting tightly-scoped, loosely coupled services.
An event like this is also a good opportunity to check in with services that have existed for a long time to stay current on new features. A good example of these are AWS Storage Gateway and Elastic Filesystem which have both seen further development since their initial launch. A service that impressed us thoroughly is Aurora: Amazon's enterprise-grade MySQL-compatible database engine. It shows how effectively AWS can squeeze out performance and reliability improvements when they are in control of the whole infrastructure stack. Several of our clients use Aurora, and it is good to see that this will pay dividends as we inherit regular improvements from Amazon's continued development.
Another thing that struck us was the theme of Adrian Cockcroft’s keynote: public cloud providers have moved beyond allowing you to do the same things you did in your datacenter and are now providing capabilities that would be nearly impossible without massive investments in capital and talent. Take this example: CSPAN is annotating all of its video coverage of US politics by sampling frames and running them through Amazon Rekognition to detect the faces of politicians.
It’s obvious that cloud computing has moved beyond the startups. All major enterprises are making use of some form of cloud services and many are “all in”. The uncertainty and fear of moving workloads from your own bespoke data center to a cloud provider is a throwback to the last decade. How are we so sure? Consider this: McDonalds’ global Point of Sale system runs entirely on Amazon Web Services.
On Tuesday (6/20/2017), the Leaf team gathered for a round of lightning talks given by Leaf employees. The format was as follows: Speakers had 5 minutes to present on whatever they wanted. No slide deck required.
Jimmy Briggs gave some insight into his passion for mechanical keyboards. Using a hands-on show-and-tell approach, he gave everyone a chance to experience the feel of a mechanical keyboard as well as the variety of switch types that are available out there.
Optimizing Unit Test Fixtures
Frederick Myers shared some of the tips that his team uses for optimizing unit tests fixtures for speed, navigation, and consistency.
"Strangify" - Slack and OpenCV
Mike Warren pulled back the curtain on "Strangify" -- our slack app that uses OpenCV to detect faces on images and replace them with pictures of our own infamous James S.
Python Tornado web framework
James' second talk was an overview of the Python Tornado web framework that James is evaluating for IndyPY Web Framework Shootout.
It was great for everyone to get together for fun as well as an opportunity to share and learn (and have some pizza).
Answering the question "Does this make us better?" is fundamental at Leaf and why we subscribe to following the principles of the agile manifesto rather than adopting a single agile framework and apply it across the board.
By not adhering to a single framework, we are afforded the flexibility of picking what works best for us and the customer. We incorporate practices such as daily stand-ups, sprints, Kanban flow, deploy often, automation, and retrospectives. We are able to integrate with other customers that might be invested in more formal methodologies such as Scrum or SAFe. For customers who aren't invested (or don't care) about a software methodology, by working with them we can derive project practices that make sense for both the development team and the customer based upon everyone's needs and capacity. And sometimes, that can involve eschewing agile a bit and incorporating waterfall techniques.
From a project perspective, our company launched as the industry was shifting from centralized, mainframe-based computing to distributed PC-based computing. As the 80s rolled over to the 90s, employees at Joseph Graves Associates were providing services across a wide variety of client sizes ranging from accounting services, staff augmentation, and custom development.
As the Internet became a household name, Leaf began providing web development services to adapt to the needs of its clients. Microsoft Visual Basic was a popular platform, and many of Leaf’s clients included traditional companies that were realizing the potential of the efficiencies gained by incorporating computers and networks into their everyday business processes.
2007 saw the release of the first smartphones from companies such as Blackberry and the Apple iPhone. Smartphones have changed many aspects of our business and personal communications. From a technology perspective, many of us are carrying around phones in our pocket that have roughly the processing power of a Cray supercomputer that filled an entire room in 1987.
Leaf has been around to participate in some amazing technology enhancements over the past 30 years. Many other industry shifts are underway, and we plan to post about them on Leaf's brand new technical blog.
Expect to see a wide variety of topics including:
Using our Solutions Framework model, we will listen to your needs, learn your business process, and propose solutions that will often far exceed what you believed any application could do for you.
Other Leaf Blogs