Archive for January, 2009

CamlPDF Version 0.4 (for Ocaml and F#)

Tuesday, January 20th, 2009

CamlPDF Version 0.4 has been released.

The biggest change is that this release now compiles with Microsoft F Sharp as well as with OCaml.

Some major non-compatible changes have been made to the low-level API, due to the experience of building large software with the library. These should be the last such changes, at least to the basic modules.

One of the changes is that many functions which used to take a Pdf.pdfdoc and return another one now modify the document in-place. This is rather un-idiomatic for a functional library, but threading all the documents through complicated functions in code using CamlPDF became wearying.

There are several new modules:

  • PDFSpace (Parsing Colourspaces)
  • PDFText module extended for more encodings and better text extraction
  • Cff module (Parse Type 1 fonts and convert to Type 3)
  • PDFMarks (Bookmark handling - unfinished)
  • PDFAnnot (PDF Annotations - unfinished)
  • PDFGraphics (Structured graphics - unfinished - included only because Cff uses it

This release is about a third faster in general than the last one, due to profiling under .NET. Many bug fixes are included, and extra facilities for dealing with malformed PDF files.

CamlPDF is in commercial use in our Command Line PDF Toolkit and PDF Toolkit for .NET.

Keeping the Codebase Together

Tuesday, January 13th, 2009

We have to generate the following things from our OCaml codebase:

(a) Command Line PDF Tools for Windows, Mac, Linux and Solaris, demo and full versions
(b) .NET DLL by compiling with F#, demo and full versions
(c) The open-source CamlPDF library
(d) The demonstration renderer and its GUI
(e) Literate Programs for all the code

So far all this has been achieved with just plain Ocaml and a couple of makefiles and the very useful OCamlMakefile. A little trickery is required to have demo and full versions compiled from the same source.

Soon we’ll add:

(f) Plain C Wrapper for the same library exposed to .NET

which will allow the PDF library to work natively from C on any platform where OCaml can natively compile. This wrapper will be a little harder to write than the .NET wrapper, since we have less rich types available to express the various ML data structures.

I’ve also been playing with Apple’s Cocoa with Objective-C, in preparation for a new PDF-related product for OS X. I’ll be linking in the new Plain C wrapper to that. Cocoa and Objective C is all object-oriented-kool-aid, but seemingly of the less gross kind. I’ll only be using it for the interface, where it seems to work.

This will be our first consumer rather than business product, so a whole new set of problems to deal with.

.NET Toolkit Released, Command Line Tools Updated

Monday, January 5th, 2009

Our .NET PDF Toolkit, in 100% F#, cross-compiled with OCaml is now available, starting at £495. It does everything the command line tools do, and more, but is usable natively from VB.NET, C# and ASP.NET.

At the same time, we’ve updated the Command Line Tools (written in pure OCaml) with bug fixes and new features, and now provided for Solaris 10 Sparc and Intel out of the box.

The codebase of about 40,000 lines ended up requiring only 30 points at which conditional compilation was needed to cover the differences between F# and OCaml, though plenty of code had to be modified to compile in both environments in a way that didn’t require conditional compiltion.

There will be a new release of CamlPDF soon, which will have many new features, and which will cross-compile with F# out of the box.