Hi Team,
I have called the function which you have send from my swift project to objective c
below is the code.
//Swift Project
plugin.createPDF(filepath, pdfDestination: destFilePathforAgenda, pdfPassword: Password, startPageNo: 1, endPageNo: 1)
let reader = plugin.show(destFilePathforAgenda, atPage: 0, withPassword: Password, readOnly: false, autoSave: true)
if (reader == nil) {
alert(title: "No Such File", message: "")
}else{
let vc: UIViewController = reader1 as! UIViewController
self.navigationController?.navigationBar.isTranslucent = false;
self.navigationController?.pushViewController(vc, animated: true)
}
//In Objective C
-(void)createPDF:(NSString *)PDFsource pdfDestination:(NSString *)pdfDestination pdfPassword:(NSString *)pdfPassword startPageNo:(int)startPageNo endPageNo:(int)endPageNo{
PDFDoc *doc_src;
PDFDoc *doc_dst;
doc_src = [[PDFDoc alloc] init];
doc_dst = [[PDFDoc alloc] init];
[doc_src open:PDFsource :pdfPassword];
[doc_dst open:pdfDestination :pdfPassword];
NSLog(@"Source----%@",PDFsource);
NSLog(@"Destination----%@",pdfDestination);
NSLog(@"Password----%@",pdfPassword);
PDFImportCtx *ctx = [doc_dst newImportCtx:doc_src];
int pgno = startPageNo;
int pgend = endPageNo;
int pgdst = 0;
while(pgno < pgend)
{
[ctx import :pgno :pgdst];
pgno++;
pgdst++;
}
[doc_dst save];
ctx = nil;
doc_src = nil;
doc_dst = nil;
NSLog(@"created PDF");
}
No file is been created when i have called the createPDF function reader is nil when opening the PDF file with new PDF destination url which we have created.