First Name: Christian
Last Name: Haider
youtube: https://youtu.be/ehCPF89iruE
Title: PDF for Gemstone
Type: Talk
Abstract:
The PDF library PDF4Smalltalk is available in a new version under a
new name: PDFtalk. Some of the improvements are: support for bitmap pictures, annotations and the redesign of PDF types. New is also a version for Gemstone. For this purpose, a new “VisualWorks to Gemstone” fileOut library was written. The approach will be presented.
Bio:
Christian Haider is using Smalltalk since 1992 and never had to leave it since. He experienced large projects as employee and
consultant. Since 2002 he works in on "smallCharts", a charting tool for newspapers. 2011 he published a PDF Library for VisualWorks. His interest is in Graphics and User interfaces
2. PDFtalk
Overview
• News from the PDF library for VisualWorks
• New „PDFtalk for Gemstone“
• New goodie for porting VW code to
Gemstone
„Gemstone Fileout Project“
ESUG 2017 2
3. PDFtalk
PDFtalk – PDF library version 2
• Commercial intent
– More professional support
– End user tools
ESUG 2017 3
4. PDFtalk
Whats new in PDFtalk
• Typing redesigned
• Added basic support for annotations
• (older) support for bitmapped images
ESUG 2017 4
5. PDFtalk
Typing in PDFtalk
• PDF objects are typed
– Some explicitely
– Some implicitely
• (acquired by being in an attribute of an object)
(show)
ESUG 2017 5
7. PDFtalk
Typing in PDFtalk
• Advantages of the new typing design
– Aids porting to non-namespace Smalltalks
– Ordinary classes can act as PDF objects
• UndefinedObject, Boolean, Number (to be done)
(show)
ESUG 2017 7
8. PDFtalk
Change for the user
• Instead of using the class itself
Page
• one should use
PDF classAt: #Page
• The implementation classes can be named
different now
• Often used classes can be accessed directly
PDF Dictionary
– Instead of (PDF classAt: #Dictionary)
– the implementation class is now PDFDictionary
ESUG 2017 8
9. PDFtalk
PDFtalk for Gemstone
• Free MIT licence
• Paid work for a HTS
– To create PDFs from a Seaside application
– Using the report tool of Bob Nemec
• Just the server part – no tools or UI
ESUG 2017 9
10. PDFtalk
PDFtalk namespaces in Gemstone
ESUG 2017 10
Globals
PDFtalkLibrary
UserGlobals
Published
PDFtalk Fonts
CFF
OpenType
PDFtalk.Fonts.Type1Font (in VisualWorks)
(PDFtalk at: #Fonts) at: #Type1Font (in Gemstone)
(All PDF objects) (Font objects)
Type1Font
…
11. PDFtalk
Porting challenges
• Learning Gemstone
• Something similar to namespaces
• Different approaches
• Other tools
– No support for namespaces
– No tests
• => Rolled my own
ESUG 2017 11
12. PDFtalk
Porting approach
• Generate Topaz input file from VW
• Based on GLASS (with seaside loaded)
• No changes to the origin
• No compatibility libraries for VW or GS
• Describe the transformation declaritively
only
ESUG 2017 12
14. PDFtalk
Porting Strategy II
• Make the tests pass
– Reimplement items depending on VW infrastructure
• Encoders
• Font support
• UninterpretedBytes -> Byte(Read|Write)Stream
– Create common abstractions
• Pragmas
– Understand differences
• Streams (Line end convention (cr / lf)), different
semantics
• Numbers (LargeIntegers, printString of Floats)
ESUG 2017 14
15. PDFtalk
More differences
• Some classes don‘t like #new
• printString is usually different
• Different error class hierarchy
• #thisContext not in Gemstone
• Announcers need to be subclass of Announcer
• Streams: different semantics
• Timestamp: includes offset (time zone) in GS
ESUG 2017 15
16. PDFtalk
Fun Facts I
• Colors
– Representation
• VW: 13 bit per component
• Squeak: 10 bits
– Names
• VW: 31
• GS: 35
• Common: 18
ESUG 2017 16
17. PDFtalk
Fun Facts II
ESUG 2017 17
black
white
red
green
blue
cyan
magenta
yellow
gray
lightGray
veryLightGray
darkGray
veryDarkGray
brown
lightCyan
orange
paleGreen
lightYellow
VW GS VW GS
18. PDFtalk
Fun Facts III
(show)
• Different base dates
– Unix: 1.1.1970
– VW: 1.1.1900
– GS: 1.1.1900 and 1.1.2000
– OpenType: 1.1.1904
• Dont use #fromSeconds: and #asSeconds
ESUG 2017 18
19. PDFtalk
Porting Strategy
• VW is the source
• VW should not change
• Output by transformations
– Add method
– Add system method
– Ignore method
– Replace method
– Rewrite method
(show)
ESUG 2017 19
20. PDFtalk
Gemstone Fileout
• Open source with MIT licence
• Describe the differences as a Value
– Measure of portability
– General transforms
– Specific transforms
ESUG 2017 20
21. PDFtalk
Thank you for your attention!
Questions?
More information at http://wiki.pdftalk.de
ESUG 2017 21