0

I am making a pdf app in which i get problem

    // make  pdf
    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,    NSUserDomainMask, YES);
    NSString *documentsDirectory = [paths objectAtIndex:0];
    BOOL isFileCreated;

    if(isPortrait)
    {
        isFileCreated = UIGraphicsBeginPDFContextToFile([NSString stringWithFormat:@"%@/test.pdf",documentsDirectory],CGRectMake(self.m_ScrollView.frame.origin.x, self.m_ScrollView.frame.origin.y-340, self.m_ScrollView.frame.size.width, self.m_ScrollView.contentSize.height), nil); 

    }
    else
    {
        isFileCreated = UIGraphicsBeginPDFContextToFile([NSString stringWithFormat:@"%@/test.pdf",documentsDirectory],CGRectMake(self.m_ScrollView.frame.origin.x, self.m_ScrollView.frame.origin.y-250, self.m_ScrollView.frame.size.width, self.m_ScrollView.contentSize.height), nil); 
    }

    if(isFileCreated)
    {
        UIGraphicsBeginPDFPage();
        [self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
        UIGraphicsEndPDFContext();
    }

this code creates only half pdf. which currently shows on the screen and rest of the pdf is missing which is currently not shown on screen.what should i do? thanks in advance.

Hiren
  • 12,720
  • 7
  • 52
  • 72
Bond
  • 328
  • 4
  • 16
  • here am using UIGraphicsGetCurrentContext() method. i think it renders only currently showing area. is there any way to render all the area of view. – Bond Mar 27 '12 at 13:24