Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
pdftalk4gemstone [2017/10/12 19:23]
christian [Demos]
pdftalk4gemstone [2022/03/07 10:31] (current)
bekki
Line 1: Line 1:
 ====== PDFtalk for Gemstone ====== ====== PDFtalk for Gemstone ======
  
-Library for reading and writing PDF files in Gemstone.+Library for reading and writing PDF files in [[https://github.com/GsDevKit/GsDevKit_home|GsDevKit for Gemstone]].
  
-The source comes in two files: **''PDFtalk.gs''** with the runtime code and **''PDFtalkTesting.gs''** with tests and demos. UI tools and helpers used in VisualWorks are not included, because of the server nature of Gemstone.+The source is on [[https://github.com/ChristianHaider/PDFtalk-for-Gemstone|on Github]] and comes in two files: **''[[https://github.com/ChristianHaider/PDFtalk-for-Gemstone/blob/master/PDFtalk.gs|PDFtalk.gs]]''** with the runtime code and **''[[https://github.com/ChristianHaider/PDFtalk-for-Gemstone/blob/master/PDFtalkTesting.gs|PDFtalkTesting.gs]]''** with tests and demos. UI tools and helpers used in VisualWorks are not included, because of the server nature of Gemstone.
  
-The library needs Seaside (and Grease) as prerequisite.+With [[releasenotes#pdftalk_250|version 2.5]] a new file of the library with the 182 standard [[cmap|CMaps]] was added: **''[[https://github.com/ChristianHaider/PDFtalk-for-Gemstone/blob/master/PDFtalkWithCMaps.gs|PDFtalkWithCMaps.gs]]''**.
  
 The new symbol dictionary **''PDFtalkLibrary''** will appear in the symbol list after filein (and **''PDFtalkTesting''** after filing in the testing file). This symbol dictionary represents the namespace ''Smalltalk'' of the library with the ''Values'' code and some general tools. This dictionary need to be in scope (i.e. on the symbol list) when using it. The new symbol dictionary **''PDFtalkLibrary''** will appear in the symbol list after filein (and **''PDFtalkTesting''** after filing in the testing file). This symbol dictionary represents the namespace ''Smalltalk'' of the library with the ''Values'' code and some general tools. This dictionary need to be in scope (i.e. on the symbol list) when using it.
  
-The namespaces from VisualWorks are implemented by symbol dictionaries in Gemstone. Therefore, the ''PDFtalkLibrary'' contains the dictionary ''PDFtalk'' with all PDF classes. The ''PDFtalk'' dictionary in turn contains the ''Fonts'' dictionary which includes the ''OpenType'' and ''CFF'' dictionaries. the following slide of the ESUG 2017 presentation shows the structure:+The namespaces from VisualWorks are implemented by symbol dictionaries in Gemstone. Therefore, the ''PDFtalkLibrary'' contains the dictionary ''PDFtalk'' with all PDF classes. The ''PDFtalk'' dictionary in turn contains the ''Fonts'' dictionary which includes the ''OpenType'' and ''CFF'' dictionaries. the following slide of the [[https://www.slideshare.net/esug/pdftalk-for-gemstone|ESUG 2017 presentation]] shows the structure:
  
-{{:pdftalk_namespaces.png?nolink|Namespace dictionaries in Gemstone}}+{{:namespaces_gemstone.png?nolink|Namespace dictionaries in Gemstone}}
  
 Accessing classes in namespaces is written differently. For example: Accessing classes in namespaces is written differently. For example:
Line 24: Line 24:
  
 The dictionary ''PDFtalk'' (or the other namespace dictionaries) should not be in scope (on the symbol list) unless you extend or change the library itself. Unfortunately, you need to put the dictionaries on the symbol list in order to browse them :-(. The dictionary ''PDFtalk'' (or the other namespace dictionaries) should not be in scope (on the symbol list) unless you extend or change the library itself. Unfortunately, you need to put the dictionaries on the symbol list in order to browse them :-(.
 +
 +With the [[releasenotes#pdftalk_250|2.5 release]], the new ''PostScript'' dictionary is also present in the PDFtalkLibrary.
  
 ===== Get started ===== ===== Get started =====
  
-The proper way to get the fileout is to create it. For convenience, the files are accessible here, but I don't guarantee that they will be the most current.+The proper way to get the fileout is to create it. For convenience, the files are accessible [[https://github.com/ChristianHaider/PDFtalk-for-Gemstone|on Github]], but I don't guarantee that they will reflect the most recent version in VisualWorks. 
 + 
 +==== File out Gemstone code ====
  
-To create the fileout, you need to load the bundle ''{Gemstone Fileout Project}'' and the package ''[Gemstone Fileout PDFtalk]'' in the image with PDFtalk loaded. Then execute:+To create the fileout, you need to load the bundle ''[[SmalltalkTransform|{Smalltalk Transform Project}]]'' and the package ''[Gemstone Fileout PDFtalk]'' in an image with PDFtalk loaded. Then execute:
 <code smalltalk> <code smalltalk>
-GemstoneFileout.Writer fileOutPDFtalk. +SmalltalkTransform.Gemstone fileOutPDFtalk. 
-GemstoneFileout.Writer fileOutPDFtalkTesting.+SmalltalkTransform.Gemstone fileOutPDFtalkTesting.
 </code> </code>
  
-FileIn the resulting files ''PDFtalk.gs'' and ''PDFtalkTesting.gs'' to get the structure described above.+You should change the directory in the two methods. 
 +==== File into Gemstone ==== 
 + 
 +The library should be installed in the open source [[https://github.com/GsDevKit/GsDevKit_home|GsDevKit]] for Gemstone. In this installation, many modules from Pharo are installed which are needed by the PDFtalk library. 
 + 
 +You have to log into GsDevKit as ''DataCurator'' (only this user has the Pharo code loaded). 
 +To file-in the code do: 
 +<code> 
 +output push PDFtalk.log only 
 +input PDFtalk.gs 
 +output pop 
 +exit 
 +</code> 
 + 
 +The created log file MUST be checked for problems. If you see: 
 + 
 +<code> 
 +topaz 1> #  
 +topaz 1> # Finished file-in successfully 
 +topaz 1> #  
 +fileformat is now 8bit 
 +topaz 1> output pop 
 +</code> 
 + 
 +...then everything is OK and PDFtalk can be used. In case of a problem, you will see an error message with a useful stacktrace. 
 + 
 +Do the same to load ''PDFtalkTesting.gs''
 + 
 +When doing this repeatedly, one need to undo and clean up the previous installation with: 
 +<code> 
 +output push cleanUp.log only 
 +Doit 
 + | policy | 
 + #(#PDFtalkLibrary) do: [:dictName | 
 + (GsPackageLibrary packageNamed: dictName) ifNotNil: [:package |  
 + GsPackageLibrary uninstallPackage: package. 
 + (GsPackageLibrary packageLibrary removeDictionaryNamed: dictName)]]. 
 + policy := GsPackagePolicy current. 
 + policy homeSymbolDict: UserGlobals. 
 + policy externalSymbolList: Array new. 
 + policy enable. 
 +
 +commit 
 +</code> 
 + 
 +===== Look around ===== 
 + 
 +Loading ''PDFtalkTesting.gs'' provides all tests and some demos for the library
  
-Check the created log files if there are problems. 
 ==== Tests ==== ==== Tests ====
  
-Inspect the following:+Print the following:
 <code smalltalk> <code smalltalk>
 PDF runAllTests PDF runAllTests
 </code> </code>
-and check that 245 tests are passing without errors or failures.+and check that 497 tests are passing without errors or failures.
  
 ==== Demos ==== ==== Demos ====
Line 58: Line 108:
 </code> </code>
 to find many generated PDFs in your $HOME directory. to find many generated PDFs in your $HOME directory.
 +
 +The last demo appends all demo PDFs into this {{ :pdf:alldemos_appendpdfs.pdf |PDF}}.
  
  
 ===== Runtime considerations ===== ===== Runtime considerations =====
  
-There are some global variables caching objects (fonts, encodings, the type hierarchy). These caches are lazily filled when accessed first. In a runtime, you may want to reset and fill all caches before deploying, either because of limited rights of the runtime user or to eliminate startup overhead-.+There are some global variables caching objects (fonts, encodings, the type hierarchy). These caches are lazily filled when accessed first. In a runtime, you may want to reset and fill all caches before deploying, either because of limited rights of the runtime user or to eliminate startup overhead.
  
 After all your application code is loaded, do the following to reset and fill all caches: After all your application code is loaded, do the following to reset and fill all caches:
Line 70: Line 122:
 ===== Images ===== ===== Images =====
  
-There is code to save ImageXObjects as Value (i.e. source code which will reconstruct to object).+There is code to save ImageXObjects as Value (i.e. source code which will reconstruct the object).
 To produce the source string for a PDF image you send it ''asSource''. (Or you can send ''asPDF asSource'' to a VisualWorks Image). To produce the source string for a PDF image you send it ''asSource''. (Or you can send ''asPDF asSource'' to a VisualWorks Image).
 This string can be evaluated in Gemstone with ''evaluate'' and will reconstruct the ImageXObject, which can be put into a PDF page as usual. This string can be evaluated in Gemstone with ''evaluate'' and will reconstruct the ImageXObject, which can be put into a PDF page as usual.
Line 83: Line 135:
 anImageXObject asMethod: selectorSymbol in: protocolSymbol package: packageString anImageXObject asMethod: selectorSymbol in: protocolSymbol package: packageString
 </code> </code>
-I added several example images with this to ImageXObject. You can also look at the new ImageXTests where the images are used.+I added several example images with this to ImageXObject. You can also look at ImageXTests where the images are used.
 These methods can be transferred easily form VW to Gemstone and you get the image just by calling that method. These methods can be transferred easily form VW to Gemstone and you get the image just by calling that method.
-===== older ideas about porting ===== 
- 
-[[:gemstoneport|Preliminary thoughts]] about the porting approach for Gemstone. 
  
-Older thoughts and discussion about [[Porting]]. 
  • pdftalk4gemstone.1507829031.txt.gz
  • Last modified: 2017/10/12 19:23
  • by christian