Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # based on:
- # /System/Library/Automator/Combine PDF Pages.action/Contents/Resources/join.py
- from CoreFoundation import *
- from Quartz.CoreGraphics import *
- SRC = 'Unified_Storage_Systems_Architecture.pdf'
- DST = '7310_architecture.pdf'
- PAGES = (26, 27, 28)
- srcURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, SRC, len(SRC), False)
- srcDoc = CGPDFDocumentCreateWithURL(srcURL)
- dstURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, DST, len(DST), False)
- dstCtx = CGPDFContextCreateWithURL(dstURL, None, None)
- try:
- for i in PAGES:
- page = CGPDFDocumentGetPage(srcDoc, i)
- mediaBox = CGPDFPageGetBoxRect(page, kCGPDFMediaBox)
- CGContextBeginPage(dstCtx, mediaBox)
- CGContextDrawPDFPage(dstCtx, page)
- CGContextEndPage(dstCtx)
- finally:
- CGPDFContextClose(dstCtx)
Add Comment
Please, Sign In to add comment