This is not the answer to this question, this is another code that was used to create PDf using
UIGraphicsBeginPDFPageWithInfo. This approach also falls in more than 500 rows, but it is about 56 pages
After this approach, after returning the PDF data, when I assign this PDF data to the UIPrinterInteractionController action -
It shows SO, I can not calculate Pages
Print-Job failed: Printer exists. 2016-05-27 00:37:26.131 APPName[9078:2952235] \032Send\032to\032Mac\ 032@ \032macminiB._ipp._tcp.local.: startJob not called.
Note: while this printer error does not appear in the above code, which I posted above using UIGraphicsBeginPDFContextToData p>
-(NSData *)getPdfSimpleSOTr:(UITableView *)tableView{ #define FIRST_PAGE_HEIGHT 1188 #define REST_PAGES_HEIGHT 1176.5 CGSize fittedSize; CGRect priorBounds;
File name and path
NSString *newPDFName = [NSString stringWithFormat:@"%@.pdf", @"AppName"]; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; NSString *pdfPath = [documentsDirectory stringByAppendingPathComponent:newPDFName]; NSLog(@"%@",pdfPath);
Page creation
After GraphicsEnd will extract NSData from FilePath
NSData *pdfData; if([[NSFileManager defaultManager] fileExistsAtPath:pdfPath]) { pdfData = [[NSFileManager defaultManager] contentsAtPath:pdfPath]; } else { NSLog(@"File not exits"); } tableView.bounds = priorBounds;
source share