Alain W wrote: > I found the following piece of code > < ... > > > CFStringCreateWithCString, CFRelease and CGContextRelease are > present in FB4v2 but the others toolbox calls are missing. > > How to implement them in FB ? Or is there another way to save > Quartz drawing in Pdf format with FB ? Here's a quick translation that seems to work. Don't know if I've done everything right. Bernie; '---------- include "Tlbx CoreGraphics.incl" // More Core Graphics stuff begin globals dim as pointer gCGPDFContextCreateWithURL dim as pointer gCGContextBeginPage, gCGContextEndPage end globals local fn CGPDFContextCreateWithURL( url as CFURLRef, mediaBox as ^CGRect, ¬ auxiliaryInfo as CFDictionaryRef ) beginassem lwz r12,^gCGPDFContextCreateWithURL mtspr ctr,r12 mr r31,r2 bctrl mr r2,r31 endassem end fn local fn CGContextBeginPage( c as CGContextRef, mediaBox as ^CGRect ) beginassem lwz r12,^gCGContextBeginPage mtspr ctr,r12 mr r31,r2 bctrl mr r2,r31 endassem end fn local fn CGContextEndPage( c as CGContextRef ) beginassem lwz r12,^gCGContextEndPage mtspr ctr,r12 mr r31,r2 bctrl mr r2,r31 endassem end fn gCGPDFContextCreateWithURL = fn GetMachFunctionFromBundle( ¬ gAppServicesBundle, "CGPDFContextCreateWithURL" ) gCGContextBeginPage = fn GetMachFunctionFromBundle( ¬ gAppServicesBundle, "CGContextBeginPage" ) gCGContextEndPage = fn GetMachFunctionFromBundle( ¬ gAppServicesBundle, "CGContextEndPage" ) // CFURL.h #define CFURLPathStyle as UInt32 begin enum _kCFURLPOSIXPathStyle = 0 _kCFURLHFSPathStyle = 1 _kCFURLWindowsPathStyle = 2 end enum toolbox fn CFURLCreateWithFileSystemPath( CFAllocatorRef allocator, ¬ CFStringRef filePath, CFURLPathStyle pathStyle, ¬ Boolean isDirectory ) = CFURLRef local fn MyDrawContent( pdfContext as CGContextRef ) '~'1 dim as CGRect cgRect fn CGContextSetRGBFillColor( pdfContext, 1.0, 0.0, 0.0, 1.0 ) fn CGRectMake( @cgRect, 0.0, 0.0, 200.0, 100.0 ) fn CGContextFillRect( pdfContext, cgRect ) fn CGContextSetRGBFillColor( pdfContext, 0.0, 0.0, 1.0, 0.5 ) fn CGRectMake( @cgRect, 0.0, 0.0, 100.0, 200.0 ) fn CGContextFillRect( pdfContext, cgRect ) end fn dim as Str255 filename dim as CGRect pageRect dim as CGContextRef pdfContext dim as CFStringRef path dim as CFURLRef url filename = "MyCGPDFFile.pdf" path = fn CFStringCreateWithPascalString( 0, filename, _kCFStringEncodingUTF8 ) long if ( path ) url = fn CFURLCreateWithFileSystemPath( 0, path, _kCFURLPOSIXPathStyle, 0 ) long if ( url ) fn CGRectMake( @pageRect, 0.0, 0.0, 300.0, 300.0 ) pdfContext = fn CGPDFContextCreateWithURL( url, pageRect, 0 ) fn CGContextBeginPage( pdfContext, pageRect ) fn MyDrawContent( pdfContext ) fn CGContextEndPage( pdfContext ) fn CGContextRelease( pdfContext ) CFRelease( url ) end if CFRelease( path ) end if '----------