+ CGRect r = CGRectMake( 0 , 0 , width , height );
+
+ CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, 0);
+ m_data.reset(data);
+ CGDataConsumerRef dataConsumer = UMACGDataConsumerCreateWithCFData(data);
+ m_context = CGPDFContextCreate( dataConsumer, (width != 0 && height != 0) ? &r : NULL , NULL );
+ CGDataConsumerRelease( dataConsumer );
+ if ( m_context )
+ {
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4
+ if ( &CGPDFContextBeginPage != NULL )
+ CGPDFContextBeginPage(m_context, NULL);
+ else
+#endif
+ CGContextBeginPage(m_context, &r);
+
+ CGColorSpaceRef genericColorSpace = wxMacGetGenericRGBColorSpace();
+
+ CGContextSetFillColorSpace( m_context, genericColorSpace );
+ CGContextSetStrokeColorSpace( m_context, genericColorSpace );
+
+ CGContextTranslateCTM( m_context , 0 , height ) ;
+ CGContextScaleCTM( m_context , 1 , -1 ) ;
+ }
+#else
+ Rect r = { 0, 0, height, width };
+ m_metafile = OpenPicture( &r ) ;