Hi, I agree that the HEAD request was taking a long time, in our case we know the file size before hand, so I modified the PDFHttpStream "open" method to accept the file length. If this was passed, it was used in place of making the HEAD request call. This removed that issue.
However this is not the main issue - the issue is that the call to Document_openStream in PDFObjc.m causes ALL the remote PDF file to be downloaded.
The source for "Document_openStream" is not available so I cannot see what is happening in there, but I suspect your code must be causing the entire file to be fetched, possibly to obtain the total page count.
-(int)openStream:(id<PDFStream>)stream : (NSString *)password
{
PDF_ERR err;
if( !password )
m_doc = Document_openStream(stream, NULL, &err);
else
{
const char *pwd = [password UTF8String];
m_doc = Document_openStream(stream, pwd, &err);
}
return err;
}
If I put NSLog messages in the PDFHttpStream download_blocks method, I can see that once the following line is executed:
m_doc = Document_openStream(stream, pwd, &err);
There are many, many calls to the PDFHttpStream download_blocks method:
-(bool)download_blocks :(int) start :(int)end
Each call asks for a different range of blocks. This continues until the entire file has been downloaded as mentioned above.
Please can you look into this because at the moment, the behaviour seems wrong.
Thanks