Skip to content

Commit

Permalink
Merge pull request #77 from nkinesis/feature/export-pdf
Browse files Browse the repository at this point in the history
add export pdf functionality
  • Loading branch information
akevalion authored Aug 4, 2023
2 parents d6fb482 + bfe0fc8 commit 3ecf6eb
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ BaselineOfHierarchicalVisualizations >> baseline: spec [
hasCanvas ifFalse: [
spec
baseline: 'Roassal3'
with: [ spec repository: 'github://ObjectProfile/Roassal3/src' ]
with: [ spec repository: 'github://ObjectProfile/Roassal3/src' ].
spec
baseline: 'Roassal3Exporters'
with: [ spec repository: 'github://ObjectProfile/Roassal3Exporters' ].
].
spec
package: 'Hierarchical-Model-Events';
Expand Down
30 changes: 30 additions & 0 deletions src/Hierarchical-Roassal3-Menu/HExportasPDF.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"
this menu item allows export to PDF
"
Class {
#name : #HCollapseCanvasChildrenMenuItem,
#superclass : #HCanvasMenuItem,
#category : #'Hierarchical-Roassal3-Menu'
}


{ #category : #execution }
HCollapseCanvasChildrenMenuItem >> execute [
|destinationDir timestamp|
timestamp := DateAndTime now asUnixTime asString.
destinationDir := ('image', timestamp, '.pdf') asFileReference.
RSPDFCairoExporter new
canvas: visualization container;
exportToFile: destinationDir.
GrowlMorph openWithLabel: 'Information' contents: 'Saved ', destinationDir asAbsolute asString.
]

{ #category : #accessing }
HCollapseCanvasChildrenMenuItem >> label [
^ 'Export as PDF'
]

{ #category : #accessing }
HCollapseCanvasChildrenMenuItem >> order [
^ 1
]

0 comments on commit 3ecf6eb

Please sign in to comment.