/ CoreGraphics / CGPDFDocument.m
CGPDFDocument.m
 1  /* Copyright(c) 2008 Christopher J. W. Lloyd
 2  
 3  Permission is hereby granted, free of charge, to any person obtaining a copy of
 4  this software and associated documentation files(the "Software"), to deal in the
 5  Software without restriction, including without limitation the rights to use,
 6  copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
 7  Software, and to permit persons to whom the Software is furnished to do so,
 8  subject to the following conditions:
 9  
10  The above copyright notice and this permission notice shall be included in all
11  copies or substantial portions of the Software.
12  
13  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
15  FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16  COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17  IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
18  CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
19  
20  #import <CoreGraphics/CoreGraphics.h>
21  #import <Onyx2D/O2PDFDocument.h>
22  
23  CGPDFDocumentRef CGPDFDocumentRetain(CGPDFDocumentRef self) {
24      return [self retain];
25  }
26  
27  void CGPDFDocumentRelease(CGPDFDocumentRef self) {
28      [self release];
29  }
30  
31  CGPDFDocumentRef CGPDFDocumentCreateWithProvider(CGDataProviderRef provider) {
32      return [[O2PDFDocument alloc] initWithDataProvider: provider];
33  }
34  
35  CGPDFDocumentRef CGPDFDocumentCreateWithURL(CFURLRef url) {
36      return [[O2PDFDocument alloc] initWithURL: url];
37  }
38  
39  size_t CGPDFDocumentGetNumberOfPages(CGPDFDocumentRef self) {
40      return [self pageCount];
41  }
42  
43  CGPDFPageRef CGPDFDocumentGetPage(CGPDFDocumentRef self, size_t pageNumber) {
44      return [self pageAtNumber: pageNumber];
45  }