Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/CGPSConverter/CGPSConverter


Required plugins for this example: MBS MacCG Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacCG/CGPSConverter/CGPSConverter

This example is the version from Sun, 5th Nov 2022.

Project "CGPSConverter.xojo_binary_project"
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu7 = ""
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
MenuItem UntitledMenu6 = ""
MenuItem UntitledMenu5 = ""
MenuItem UntitledMenu4 = ""
End MenuBar
Class MyCGDataConsumer Inherits CGDataConsumerMBS
EventHandler Sub CloseConsumer() system.debuglog "CloseConsumer" End EventHandler
EventHandler Function Put(data as string) As integer system.debuglog "Put "+str(lenb(data)) buf=buf+data Return lenb(data) End EventHandler
Property buf As string
End Class
Class MyCGPSConverter Inherits CGPSConverterMBS
EventHandler Sub BeginDocument() system.debuglog "BeginDocument" End EventHandler
EventHandler Sub BeginPage(PageNumber as integer, PageInfo as Dictionary) system.debuglog "BeginPage "+str(PageNumber) End EventHandler
EventHandler Sub EndDocument(success as boolean) system.debuglog "EndDocument" End EventHandler
EventHandler Sub EndPage(PageNumber as integer, PageInfo as Dictionary) system.debuglog "EndPage" End EventHandler
EventHandler Sub Finished() system.debuglog "Finished" End EventHandler
EventHandler Sub Message(message as string) system.debuglog "Message " System.DebugLog message End EventHandler
EventHandler Sub Progress() system.debuglog "Progress" End EventHandler
End Class
Class App Inherits Application
EventHandler Sub Open() dim psconverter as MyCGPSConverter dim f as FolderItem dim dp as CGDataProviderMBS dim dc as MyCGDataConsumer dim output as TextOutputStream f=FindFIle("test.ps") if not f.Exists then MsgBox "Please change the name of the source .ps file in the source code!" else // Read PS File // Create data provider dp=CGDataProviderMBS.CreateWithFile(f) if dp<>Nil then dc=new MyCGDataConsumer psconverter=new MyCGPSConverter(nil) if psconverter.Convert(dp,dc,nil) then f=SpecialFolder.desktop.Child("test.pdf") output=f.CreateTextFile if output<>nil then output.Write dc.buf output.Close #If RBVersion < 2019 Then f.MacCreator="prvw" f.MacType="PDF " #EndIf f.Launch end if end if end if end if quit End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
End Class
End Project

The items on this page are in the following plugins: MBS MacCG Plugin.


The biggest plugin in space...