User Tools

Site Tools


pdf:quovadis

Quo vadis?

Submitted by ChristianHaider on Fri, 2012-02-03 13:56

The library has been in the open for about 4 months now and there has been some interest (see Bob Nemec's Report4PDF external). One recurring comment from other lurkers is that the library is very low-level and that you need to understand the PDF specification in order to do anything useful. That is true. The library is a system library intended for programmers with knowledge and interest in graphics and/or text. For application programmers, there is not much support yet and some important parts are even missing.

An application library should provide a drop-in VisualWorks GraphicsContext for PDF. Any drawing code for the screen or printer or PostScript would just work also for PDF. The more advanced features of PDF could not be used due to the outdated VW graphics, but that is not a problem for code using it today.

In order to program such GraphicsContext, a couple of obstacles need to be removed: TrueType fonts, Font subsetting and Bitmap images.

TrueType fonts

Currently, there is only support for Type1 fonts (including the 14 standard fonts) and OpenType fonts (PostScript variant). TrueType fonts and its OpenType variant are not implemented yet.

Once that is done, all commonly used fonts on all platforms could be used with PDF4Smalltalk (except for bitmap fonts, which are not much in use nowerdays).

Doing it is not too difficult, I guess. The specification is freely available and since OpenType is a decendent of TrueType which I partly implemented already, it is just a matter of reading and programming the relevant parts of the spec.

I will implement this one day. At latest when a smallCharts customer asks for it…

Font subsetting

Currently, fonts are embedded into the PDF completely. This is simple and it works. Unfortunately, this is not legal for most fonts in publicly available PDF documents (PDFs with fonts you do not own). Font subsetting rearranges the fonts to only include the glyphs which are actually used in the document. Such a font is not very useful when it is extracted and, therefore, most fonts have a licence to allow this.

Also the size of a PDF may be reduced significantly by omitting the characters not used.

The implementation is not too complex. It requires a finer level of control of how characters are used. This level is important because it opens up more possibilities like kerning, ligatures and such.

This is high on my list to do! If I just had a free week to do it…

Bitmap images

Currently, there is virtually no support for Bitmaps. Only 8-bit grayscale images can be used.

The implementation is low-level bit fiddling - at least tests are easy. There various VW formats: 1, 2, 4, 8, 16, 24 and 32 bit have to be mapped to the PDF 1, 2, 4, 8 or 16 bits per component images. This may involve interpolation of pixel values.

I do not have any plan to do this. I do not have a business case for that and not that much free time to do it for fun :-(. My hope is that someone in the community would have a strong interest to implement this…

QuoVadisComments

/var/www/virtual/code4hl/html/dokuwiki/data/pages/pdf/quovadis.txt · Last modified: 2015/03/31 12:39 by christian