Microsoft Windows Phone 8.1 support ends (13 Jul 2017)

Microsoft has ended support for Windows Phone 8.1

Questions about iOS development and PDF

I want to show pdf from certain page to certain page not whole pdf.

More
IP: 114.143.41.131 7 years 3 months ago #14389 by apdeveloper
Dear Team,
Thank you for your reply.

The above code which you have shared is giving an error for this lines.
[doc_src open:@"source path to extists pdf file"]; //No visible @interface for 'PDFDoc' declares the selector 'open:'
[doc_dst open:@"dest path to creating pdf file"];//No visible @interface for 'PDFDoc' declares the selector 'open:'
PDFImportCtx *ctx = [doc_src newImportCtx]; //No visible @interface for 'PDFDoc' declares the selector 'newImportCtx'
More
IP: 212.97.62.176 7 years 3 months ago #14390 by emanuele
Hi,
simply missing pwd and doc_src params, here is the code:
Code:
PDFDoc *doc_src; PDFDoc *doc_dst; doc_src = [[PDFDoc alloc] init]; doc_dst = [[PDFDoc alloc] init]; [doc_src open:@"path to file" :@"file pwd"]; [doc_dst open:@"path to file" :@"file pwd"]; PDFImportCtx *ctx = [doc_dst newImportCtx:doc_src]; int pgno = 5; int pgend = 10; int pgdst = 0; while(pgno < pgend) { [ctx import :pgno :pgdst]; pgno++; pgdst++; } [doc_dst save]; ctx = nil; doc_src = nil; doc_dst = nil;
More
IP: 114.143.255.203 7 years 3 months ago #14394 by apdeveloper
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.
More
IP: 111.196.241.59 7 years 3 months ago - 7 years 3 months ago #14395 by radaee
sorry, some wrong on previous codes, you shall call [PDFDoc create] to create PDF file.
so codes like:
Code:
PDFDoc *doc_src; PDFDoc *doc_dst; doc_src = [[PDFDoc alloc] init]; doc_dst = [[PDFDoc alloc] init]; [doc_src open:@"source path to extists pdf file", @"password"]; [doc_dst create:@"dest path to creating pdf file"]; PDFImportCtx *ctx = [doc_src newImportCtx]; int pgno = page_range_start; int pgend = page_range_end; int pgdst = 0; wile(pgno < pgend) { [ctx import :pgno :pgdst]; pgno++; pgdst++; } [doc_dst save]; ctx = nil; doc_src = nil; doc_dst = nil;


[doc_src open:@"source path to extists pdf file", @"password"];
[doc_dst create:@"dest path to creating pdf file"];


these 2 invoking is most important.
and both path shall be in sandbox of app.
Last edit: 7 years 3 months ago by radaee.
More
IP: 114.143.90.14 7 years 3 months ago #14400 by apdeveloper
Dear Team,

Pdf is not getting created as both the path are of sandbox of app.
//Below is the code which i am calling for creating pdf and opening pdf from my swift project.

plugin.createAgendaPDf(filepath, pdfDestination: destFilePathforPDF, pdfPassword: Password, startPageNo: 1, endPageNo: 2)
let reader = plugin.show(destFilePathforPDF, atPage: 0, withPassword: "", readOnly: false, autoSave: true)

//reader is nil always and app is getting crash.
for creating pdf i have used the last code which you have send for creating pdf.
More
IP: 212.97.62.176 7 years 3 months ago #14404 by federico
Dear apdeveloper,
Here's create PDF's working method:
Code:
PDFDoc *doc_src; PDFDoc *doc_dst; doc_src = [[PDFDoc alloc] init]; doc_dst = [[PDFDoc alloc] init]; [doc_src open:@"your source path" :@"password"]; [doc_dst create:@"your destination path"]; PDFImportCtx *ctx = [doc_dst newImportCtx:doc_src]; int pgno = 5; int pgend = 10; int pgdst = 0; while(pgno < pgend) { [ctx import :pgno :pgdst]; pgno++; pgdst++; } [doc_dst save]; ctx = nil; doc_src = nil; doc_dst = nil;
Time to create page: 0.459 seconds
Powered by Kunena Forum