Tuesday, October 15, 2013

Generating dynamic PDF documents using the Open Source Scryber library

Inline images 1

Introduction
It has always been a chore to create dynamic PDF documents. And even harder to create good looking dynamic PDF documents. It usually involves reams of custom code, hard coded element placement, and at least a little knowledge of how PDF documents are structured.

With Scryber, writing PDF documents has now become as easy as creating HTML pages. Cascading styles and data binding are supported along with generic layout components - page headers, lines, text blocks, columns, containers, images, fonts, etc. 

Background 
Scryber is an open source PDF Library, created by PerceiveIT Limited, and released under the LGPL license. This is less restrictive than other GPL libraries and allows you to link your commercial applications as well as open source applications - provided you have not modified the original Scryber source code.

Overview
To show some of the capabilities of the Scryber library this article is going to take the CodeProject New Articles RSS feed (available here http://www.codeproject.com/WebServices/ArticleRSS.aspx) and build a nice PDF document with the contents of the feed similar to below.

...
...

<?xml version="1.0" encoding="utf-8"?>
<pdf:Document xmlns:pdf="Scryber.Components, Scryber.Components" auto-bind="true" >
  <Pages>
    <pdf:Page id="MyFirstPage" >
      <Content>
        Hello World
      </Content>
    </pdf:Page>
  </Pages>
</pdf:Document>


Read more: Codeproject
Read more: Scryber
QR: Inline images 2