can't load network PDF file - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
13 Jul 2017
Microsoft has ended support for Windows Phone 8.1
Read More...
Questions about iOS development and PDF

TOPIC: can't load network PDF file

can't load network PDF file 3 years 3 months ago #9458

  • NovaRadaeePdf
  • NovaRadaeePdf's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
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];

Please Log in or Create an account to join the conversation.

can't load network PDF file 3 years 3 months ago #9461

  • NovaRadaeePdf
  • NovaRadaeePdf's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
I'm in a hurry! thank you!

Please Log in or Create an account to join the conversation.

can't load network PDF file 3 years 3 months ago #9462

  • stronglee
  • stronglee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 92
  • Karma: 1
  • Thank you received: 2
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];

Please Log in or Create an account to join the conversation.

can't load network PDF file 3 years 3 months ago #9487

  • NovaRadaeePdf
  • NovaRadaeePdf's Avatar Topic Author
  • Offline
  • Junior Boarder
  • Junior Boarder
  • Posts: 20
  • Thank you received: 0
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!

Please Log in or Create an account to join the conversation.

can't load network PDF file 3 years 3 months ago #9493

  • emanuele
  • emanuele's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 523
  • Karma: 20
  • Thank you received: 60
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.

Please Log in or Create an account to join the conversation.

can't load network PDF file 3 years 3 months ago #9495

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 571
  • Karma: 6
  • Thank you received: 46
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 .

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum