diff options
Diffstat (limited to 'Build/source/texk/web2c/xetexdir/XeTeX_mac.c')
-rw-r--r-- | Build/source/texk/web2c/xetexdir/XeTeX_mac.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c index 4c64a65feb4..5228c669ab9 100644 --- a/Build/source/texk/web2c/xetexdir/XeTeX_mac.c +++ b/Build/source/texk/web2c/xetexdir/XeTeX_mac.c @@ -961,6 +961,31 @@ loadAATfont(ATSFontRef fontRef, long scaled_size, const char* cp1) } int +countpdffilepages() +{ + int rval = 0; + + char* pic_path = kpse_find_file((char*)nameoffile + 1, kpse_pict_format, 1); + CFURLRef picFileURL = NULL; + if (pic_path) { + picFileURL = CFURLCreateFromFileSystemRepresentation(kCFAllocatorDefault, (UInt8*)pic_path, strlen(pic_path), false); + if (picFileURL != NULL) { + FSRef picFileRef; + CFURLGetFSRef(picFileURL, &picFileRef); + CGPDFDocumentRef document = CGPDFDocumentCreateWithURL(picFileURL); + if (document != NULL) { + rval = CGPDFDocumentGetNumberOfPages(document); + CGPDFDocumentRelease(document); + } + CFRelease(picFileURL); + } + free(pic_path); + } + + return rval; +} + +int find_pic_file(char** path, realrect* bounds, int pdfBoxType, int page) { *path = NULL; |