Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8574987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:35:48+00:00 2026-06-11T19:35:48+00:00

Actually I need to make pdf file for all transaction in my project. So

  • 0

Actually I need to make pdf file for all transaction in my project. So I creating PDFViewController Class with .xib that contains uiView,uitableView,etc.

I am not displying this class to user, interally I am taking screen shots of this class view to make pdf for all transactions.

My problem is that I can take screen shot view and table but I have lot of rows in table so I need to scroll it to take screen shot only for tableview but its not scrolling.

please see the below code any help would be highly appreciated. Thanks

@implementation PDFViewController

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *cellIdentifier=@"PDFCustomCell";
    PDFViewCustomCell *cell=(PDFViewCustomCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (cell==nil) 
    {
        NSArray *nib=[[NSBundle mainBundle]loadNibNamed:@"PDFViewCustomCell" owner:self options:nil];

        cell=[nib objectAtIndex:0];
        nib=nil;
    }

    //@autoreleasepool {

    PDFPrint *pdfObj=[self.arrProducts objectAtIndex:indexPath.row];

    cell.unitPrice.text=[currencyFormator stringFromNumber:[NSNumber numberWithDouble:[pdfObj.unitPrice doubleValue]]];
    UIImage* img =  [UIImage imageWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/downloads/%@/files/%@.jpg",del.LocalPath,del.CompFolder,del.RepId,pdfObj.code]];
    if(img!=nil)
        [cell.imageView setImage:img];
    else
        [cell.imageView setImage:[UIImage imageNamed:@"no_privew95x77.jpg"]];
        pdfObj=nil;
            return cell;
    //}
}
  • (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
    NSLog(@”Array Count is = %i”,[self.arrProducts count]);
    return [self.arrProducts count];
    }

    • (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
      {
      return 1;
      }
    • (void)viewDidLoad
      {
      [super viewDidLoad];

      NSString* strlogopath = [NSString stringWithFormat:@”%@/%@/%@”,del.LocalPath,del.CompFolder,del.CompInfo.ImageName];
      [self.imgLogo setImage:[UIImage imageWithContentsOfFile:strlogopath]];
      strlogopath = nil;
      [self filldata];

    }
    -(void)filldata
    {
    //here I am filling Data from many tables in arrProduct NSMutableArray I have removed number of lines for StackOverflow for code complexity. I am getting Data in arrProduct accurately.

            [self.arrProducts addObject:pdfData];
    
    
        [SQLHelper finalizeStatement:stmt];
    }
    @catch (NSException *exception)
    {
        NSLog(@"%@",exception.description);
    }
    @finally 
    {
        [SQLHelper disconnectDB:database];
    }
    

    }

    @end

    // CurrentTransaction.m
    // in the currentTransaction.m I am not adding the self.pdfViewController view bcoz I don’t need to show it. I have to take screen shot only then need to make pdf file
    the problem is I can’t scroll table to take next rows screen shot.

    • (UIView *)loadTemplate:(PrintChoice_t)type
      {
      if (type==Small_Photo)
      {
      self.pdfViewController=[[PDFViewController alloc]initWithNibName:@”PDFViewController” bundle:[NSBundle mainBundle] ReferenceController:& self];
      }
      return self.pdfViewController.view;
      }

    //someWhere in this class I am calling

    [self.pdfViewController.tblProd scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:14 inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO];

    //But scrollToRowAtIndexPath not calling CellForRowAtIndexPath in PDFViewController. I can see debug info only 14 rows visible 0 location 14 rows.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T19:35:49+00:00Added an answer on June 11, 2026 at 7:35 pm

    You are accessing the table in another view controller (pdfViewController from CurrentTransaction view controller), yet you are passing as an indexpath the CurrentTransaction view indexPath, which will be either nil, if your CurrentTransaction view doesn’t have a tableView or if the TableView has not 14 rows, or it will have a non valid NSIndexPath.

    I would suggest adding a custom public method in your pdfViewController, that will scroll to the row. Something like this:

    - (void)scrollToRow:(int)row atSection:(int)section {
         [self.tblProd scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:14 inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO]
    }
    

    Then in CurrentTransaction.m replace

    [self.pdfViewController.tblProd scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:14 inSection:0] atScrollPosition:UITableViewScrollPositionNone animated:NO];
    

    with:

    [self.pdfViewController scrollToRow:14 atSection:0];
    

    Should work fine then!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'd like to: Make commonly required services visible to all classes that need them,
Actually We are doing thesis work where we need to make 10 voip phones
Actually in one of my project i need to read images from remote server
Actually I have to upload pdf files and need to read on my website
Actually I need to make a custom url like www.{mydomainname}.com/username, for which i added
I need to make a Javascript object that would behave as an associative array,
I currently have a class that uses template arguments. I need an array of
Let's say, hypothetically (read: I don't think I actually need this, but I am
I'm getting pretty big input string into my method, but what I actually need
I am trying to understand simple snaplet construction. Also, when do I actually need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.