Example: /MacCG/Rotate PDF Page

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/MacCG/Rotate PDF Page


Required plugins for this example: MBS MacCG Plugin, MBS MacCF Plugin

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

This example is the version from Sun, 17th Mar 2012.

Project "Rotate PDF Page.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
EventHandler Sub Open() // Rotate a PDF page // our files dim sourcefile as FolderItem = SpecialFolder.Desktop.Child("test.pdf") dim destfile as FolderItem = SpecialFolder.Desktop.Child("rotated.pdf") // open PDF dim pdf as CGPDFDocumentMBS = sourcefile.OpenAsCGPDFDocumentMBS // query media size of first page dim r as CGRectMBS = pdf.MediaBox(1) // create new PDF dim c as CGContextMBS = destfile.NewCGPDFDocumentMBS(r,"title","Author","Creator") // create rotated rectangle dim nr as new CGRectMBS(0,0,r.Height,r.Width) // create new page c.BeginPage nr c.SaveGState const pi = 3.14159265 // rotate by 90° c.RotateCTM pi*1.5 // fix origin c.TranslateCTM -r.width,0 // draw PDF c.DrawCGPDFDocument pdf,r,1 // cleanup c.RestoreGState c.EndPage c = nil // show in PDF viewer destfile.Launch End EventHandler
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

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


💬 Ask a question or report a problem