[pdf4st] What is the status of PDF on non-Windows machines

  • From: "Christian Haider" <Christian.Haider@xxxxxxxxxxxxxxxxxxxxxxx>
  • To: <pdf4st@xxxxxxxxxxxxx>
  • Date: Fri, 20 Apr 2012 16:30:04 +0200

(originally submitted by bobcalco on Tue, 2012-01-24 08:36) 

I was delighted yesterday to discover PDF4Smalltalk, as I have a fairly
complex, data driven document that I need to render now that I made the
bold switch from Ruby to Smalltalk. (Well, bold in my opinion, but if I
don't hit my deadlines, I don't think it will impress my users.) 

I was chagrined to discover how low-level and in the weeds it is, but in
itself that's not a problem. 

However I was dismayed to read in your presentation from last year that
it only works on Windows. I hope this is only referring to the reader
renderer, and that I am able to use PDF to *generate* PDF content on
Linux. I will be running a web app on Linux and need to replace
functionality previously provided by the Prawn library in Ruby. 

Can you clarify the status of support on Linux and suggest how I can
help out? 


PDF4Smalltalk is platform independent


Submitted by ChristianHaider on Tue, 2012-01-24 11:30.

Cool! Switching from Ruby to Smalltalk is bold and I hope you will like
it :-). 

Yes, PDF4Smalltalk is low-level and "in the weeds" :-). Intentionally.
The library provides the mapping between PDF and Smalltalk objects and
basic facilities like file reading and writing, type checking, resources
management (fonts, images and the like) and documentation. Any higher
abstractions for text, graphics, layout etc. have to be done by the
user, since they are application dependend. For example in my products I
have cool classes for vector graphics, but not much for text or layout.
Other applications like a report writer needs good concepts for layout
and text, but not more than the bounding box for graphics (see Bob
Nemec's work  
<http://smalltalk-bob.blogspot.com/2012/01/pdf-report-and-law-of-demeter
.html> ). 

Think of PDF4Smalltalk as a box with Lego stones. Many different kinds
of Lego stones (PDF objects) are provided (as Smalltalk objects) with
the right connectors (type checking). With this you can build your
castle! 

The library itself is completely platform independent. It should work
without problems on any platform VW runs on (Windows, Mac, Linux, AIX
etc.). So, generating PDFs on Linux should work out-of-the-box. 

Only the tools I use for development are programmed for Windows: 

*       FontExplorer: uses file-drop-on-window and renders glyphs with
Windows GDI 
*       PDFExplorer: uses file-drop-on-window 

Modifying the PDFExplorer to run on Linux should not be difficult - you
just can't drop PDFs onto the window. But I have not tried... 

I would be interested in what you think of the differences between
PDF4Smalltalk and Prawn for Ruby. 

Good luck and happy hacking :-) 


Show-Stopper on Unix Platforms


Submitted by mac on Thu, 2012-02-09 12:01.

On Unix platforms the installation of the fonts in Font
class>>loadedFonts crashes, therefore fonts cannot be accessed at all. 

"Problem child" is the Graphics.Fonts.OpenType.Font class>>freeSansBold.


in FontBody class>>installFromFont: aFont ... PostScriptFonts at:
fontBody name put: fontBody. ... 

the fontBody returns nil when asked for its name. 

The fontBody gets its name from aFont>>postScriptName that is nil. 

Our font's postScriptName is assembled from entry 'name' in the tables
instanceVar. That is an instace of Graphics.Fonts.OpenType.Name. 

That object holds a collection of nameRecords that include platformIDs. 

nameAt: nameId "<String | nil>" 

^(self nameRecords detect: [:nameRecord | nameRecord platformID = self
platformID and: [ nameRecord nameID = nameId]] ifNone: [ ^nil]) string 

returns nil because there are unfortunately only nameRecords for Mac and
Windows. 

As far as I see are the nameRecords directly build from the contents of
that gnu-Font and they just do not support unix platforms!?? 

Anyway, that problems/exceptions should be handled on a high level (Font
class>>loadedFonts). If the installation of a single font fails it
should be left away and the other ones should go through. 

PNG image

Other related posts:

  • » [pdf4st] What is the status of PDF on non-Windows machines - Christian Haider