Platforms to show: All Mac Windows Linux Cross-Platform

CGPDFDocumentMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class CoreGraphics MBS MacCG Plugin 2.7 ✅ Yes ❌ No ❌ No ✅ Yes All
A class for a core graphics pdf document.
Example
dim f as FolderItem
dim input as CGPDFDocumentMBS
dim output as CGContextMBS
dim r,c as CGRectMBS

f=SpecialFolder.Desktop.Child("test.pdf")
input=f.OpenAsCGPDFDocumentMBS

r=CGMakeRectMBS(0,0,200,200) // 200 by 200 Pixel page

f=SpecialFolder.Desktop.Child("output.pdf")
output=f.NewCGPDFDocumentMBS(r,"SomeTitle","SomeAuthor","SomeCreator")

// Create a new page
output.BeginPage r

// get size of input page one
c=input.CropBox(1)

// clip to a part of the new page leaving a border
r=CGMakeRectMBS(20,20,160,160)
output.ClipToRect r

// draw old pdf on a different position
c.top=-100
c.left=-100

// do the drawing of page one of input at new new output
output.DrawCGPDFDocument(input,c,1)

// cleanup
output.EndPage
output.Flush

If the release property is true, the destructor of this class will release the pdfdocument reference.

This class has no sub classes.

Some useful global functions for this class:

Some methods using this class:

Some properties using for this class:

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Release notes

  • Version 17.3
    • Added check to CGPDFDocumentMBS to raise out of memory exception in low memory conditions to avoid crashes later.

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


CGPDFDictionaryMBS   -   CGPDFObjectMBS


The biggest plugin in space...