tags:

views:

92

answers:

0

I am able to parse content of pdf. I am able to display pdf page as a image in scroll view. but pdf page is cut when width is more than scroll view. I want to display pdf whole page without lost its quality and contents. please give me hint.

NSArray *temp=[[contentsAtPath objectAtIndex:i]componentsSeparatedByString:@".pdf"];
    NSString *c=[temp objectAtIndex:0];
    filePath=[[NSString alloc] initWithString:[[NSBundle mainBundle] pathForResource:c ofType:@"pdf" inDirectory:@"appPdf"] ];

    [pdfNames addObject:filePath];
    initialPage=1;


    mainString=[[NSMutableString alloc] init];
    myTable=nil;
    myTable = CGPDFOperatorTableCreate();

    CGPDFOperatorTableSetCallback(myTable, "TJ", arrayCallback);
    CGPDFOperatorTableSetCallback(myTable, "Tj", stringCallback);


    CGRect pdfSize = GetPdfSize(UIGraphicsGetCurrentContext(), initialPage, [filePath UTF8String],myTable,mainString);


    //UIImageView   *imgV=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 598,768)];
    UIImageView *imgV=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, pdfSize.size.width,pdfSize.size.height)];
    UIGraphicsBeginImageContext(CGSizeMake(pdfSize.size.width,pdfSize.size.height));


    MyDisplayPDFPage(UIGraphicsGetCurrentContext(), initialPage, [filePath UTF8String],myTable,mainString);
    imgV.image=UIGraphicsGetImageFromCurrentImageContext();
    imgV.image=[imgV.image rotate:UIImageOrientationDownMirrored];






    UIButton *doneBtn = [UIButton buttonWithType:UIButtonTypeCustom]; 
    doneBtn.frame=CGRectMake(0,0,598,pdfSize.size.height);

    [doneBtn setImage:imgV.image forState:UIControlStateNormal];
    [doneBtn addTarget:self action:@selector(getDetail) forControlEvents:UIControlEventTouchDown];      
    doneBtn.tag=i+1;


    [scrollView addSubview:doneBtn];`