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

can't load network PDF file

More
10 years 5 months ago #9458 by NovaRadaeePdf
In fact, the code cann't load network PDF file, and will have Crash. Can you provide a Demo of load network PDF file for me.
Thank you very much.

char *path1 = [testfile1 UTF8String];
FILE *file1 = fopen(path1, "rb");
fseek(file1, 0, SEEK_END);
int filesize1 = ftell(file1);
fseek(file1, 0, SEEK_SET);


buffer = malloc((filesize1)*sizeof(char));
fread(buffer, filesize1, 1, file1);
fclose(file1);

[m_pdf PDFopenMem: buffer :filesize1 :nil];



//Open PDF from FileStream demo
//stream = [[PDFFileStream alloc] init];


//Open PDF HTTPStream demo
//@testUrlPath: the http pdf path you requested,this url needs support [NSURLRequest forHTTPHeaderField:@"Range"] method
//@testfile : You need set a temp path in sandbox to save the request file
httpStream = [[PDFHttpStream alloc] init];
[httpStream open:testUrlPath :testfile1];
[m_pdf PDFOpenStream:httpStream :@""];


UINavigationController *nav = self.navigationController;
m_pdf.hidesBottomBarWhenPushed = YES;
[nav pushViewController:m_pdf animated:YES];
More
10 years 5 months ago #9461 by NovaRadaeePdf
I'm in a hurry! thank you!
More
10 years 5 months ago #9462 by stronglee
Hi,
to download an url pdf, please make sure your url support [NSURLReques forHTTPHeaderField:@"Range"] mehod.
And do follow steps:
1.
NSString *testfile = [[NSTemporaryDirectory() stringByAppendingString:@""] stringByAppendingString:@"test.pdf"];
// create an temp file to save PDF file in sandbox
2. and then open PDFStream

httpStream = [[PDFHttpStream alloc] init];
[httpStream open:testUrlPath :testfile];
[m_pdf PDFOpenStream:httpStream :@""];
3. if you do this , file will open and push in when finished download
UINavigationController *nav = self.navigationController;
m_pdf.hidesBottomBarWhenPushed = YES;
[nav pushViewController:m_pdf animated:YES];
More
10 years 5 months ago #9487 by NovaRadaeePdf
Load network PDF files need to wait for a long time. What should I do to reduce the loading time? Can you tell me? Thanks you!
More
10 years 5 months ago #9493 by emanuele
Hi,

the step you followed include also:
"3. if you do this , file will open and push in when finished download"
so it could be possible that the internet connection or the pdf file size slows the procedure.
More
10 years 5 months ago #9495 by support
Replied by support on topic can't load network PDF file
You should optimize pdf for web download: each page should be arranged with its own resources ordered in the proper way.
ie.: if fonts resources are stored at the end of the pdf file, the reader won't be able to show it until all the resources would be loaded.
The same about images and annotations.

Try Acrobat Pro or other PDF editor and apply web optimization.
You should also look here www.radaeepdf.com/support/knowledge-base...component&kbartid=18 .
Time to create page: 0.502 seconds
Powered by Kunena Forum