Getting text position while parsing pdf with Quartz 2D

試著忘記壹切 提交于 2019-11-28 19:53:50

@Koteg : Hi ! Have you finally managed to get it work ? For Tm, i'm able to get all the six values, but for now i can't see how to get the position of a word into a line ... I have an idea : if we are in Tj, just get the space between letters (hopping this the same everytime) and with Tm, get the position of a word. In the case of TJ, this is quite more complicated : get the value of horizontal translation to substract to Tm matrix for each part of the array, but searching a word in that array will be more complicated than for Tj.

BTW, for others people :

for(size_t n = 0; n < CGPDFArrayGetCount(array); n += 2)
{
    if(n >= CGPDFArrayGetCount(array))
        continue;

    CGPDFStringRef string;
    success = CGPDFArrayGetString(array, n, &string);
    if(success)
    {
        NSString *data = (NSString *)CGPDFStringCopyTextString(string);
        NSLog(@"array data : %@", data);

        [searcher.currentData appendFormat:@"%@", data];
        [data release];
    }

    CGPDFReal real;
    success = CGPDFArrayGetNumber(array, n+1, &real);
    if(success)
    {
        NSLog(@"array real : %f", real);
    }
}

Thanks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!