Platforms to show: All Mac Windows Linux Cross-Platform

/DynaPDF/DynaPDF Graphics/DynaPDF Graphics Desktop
Function:
Required plugins for this example: MBS Main Plugin, MBS DynaPDF Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /DynaPDF/DynaPDF Graphics/DynaPDF Graphics Desktop
This example is the version from Sun, 16th Jan 2021.
Project "DynaPDF Graphics Desktop.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() Dim pdf As New DynapdfMBS Dim f1 As FolderItem = SpecialFolder.Desktop.Child("DynaPDF Graphics.pdf") Dim f2 As FolderItem = SpecialFolder.Desktop.Child("DynaPDF Graphics.png") Dim f3 As FolderItem = SpecialFolder.Desktop.Child("DynaPDF Graphics Rendered.png") 'pdf.SetLicenseKey "Starter" // For this example you can use a Starter, Lite, Pro or Enterprise License If Not pdf.CreateNewPDF(f1) Then Return End If Call pdf.Append Dim g As Graphics = pdf.PageGraphics draw g, pdf // for debugging, show temp picture Dim p As Picture = pdf.PageGraphicsPicture p.Save(f2, Picture.Formats.PNG) Call pdf.EndPage If pdf.HasPro Then Call pdf.RenderPageToImage(1, f3, 150, 0, 0, pdf.krfDefault, pdf.kpxfRGB, pdf.kcfFlate, pdf.kifmPNG) End If Call pdf.CloseFile Dim pic As Picture = Picture.Open(f3) backdrop = pic End EventHandler
Sub draw(g as graphics, pdf as DynaPDFMBS = nil) // this is normal code as you would use with graphics class anyway // but we use GraphicsWrapper which can be DynaPDFGraphics, too. // so graphics can go to printer, window, picture or PDF! g.DrawingColor=&c777777 g.DrawRectangle 0,0,g.Width-1,g.Height-1 g.DrawingColor=&cFF0000 g.DrawRectangle 100,100,200,200 g.DrawLine 0,0,100,100 g.DrawingColor=&c000000 g.DrawText "Hello",150,150 g.DrawLine 100,100,200,200 g.DrawingColor=&c00FF00 g.FillOval 100,0,100,100 g.DrawingColor=&c0000FF g.DrawOval 100,0,100,100 g.DrawingColor=&cFFFF00 g.FillRectangle 0,100,100,100 g.DrawingColor=&c000000 g.DrawRectangle 0,100,100,100 g.DrawingColor=&c00FF00 g.FillRoundRectangle 0,250,100,100,20,20 g.DrawingColor=&c000000 g.DrawRoundRectangle 0,250,100,100,20,20 g.DrawingColor = Color.RGB(100,200,255) Dim path As New DynapdfGraphicsPathMBS path.MoveToPoint 10, 10 path.AddLineToPoint 75, 30 path.AddLineToPoint 10, 125 path.AddLineToPoint 10, 10 g.FillPath path g.DrawingColor = &c000000 g.DrawPath path g.FontName = "Times" g.FontSize = 12 g.DrawText "Hello World", 200, 100 g.Bold = True g.DrawText "Bold", 300, 100 g.Bold = False g.Italic = True g.DrawText "Italic", 300, 120 g.Italic = False g.Underline = True g.DrawText "Underlined", 300, 140 g.Underline = False g.DrawText "Just a test with wrapping", 300, 160, 100 g.DrawText "Just a test with condensed", 300, 200, 100, True // test picture drawing dim logo as Picture = LogoMBS(200) g.DrawPicture logo, 200, 500 g.DrawPicture logo, 50, 500, 100, 200, 50, 50, 100, 100 // set a pixel 'g.Pixel(400,400)=&cFFFFFF End Sub
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

Feedback, Comments & Corrections

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

The biggest plugin in space...




Links
MBS FileMaker blog

Start Chat