【问题标题】:Objective-C: Get size of a PDF that loads inside a webpage from NSURLResponseObjective-C:获取从 NSURLResponse 加载到网页内的 PDF 的大小
【发布时间】:2011-06-10 00:31:15
【问题描述】:

如何获取网页内加载的 pdf 文件的大小?通常我使用来自 NSURLResponse 的标头来区分大小,但在这种情况下我不知道该怎么做。我得到的标题看起来像:

response headers: {
"Cache-Control" = "max-age=3600, private, must-revalidate";
"Content-Disposition" = "inline; filename=000164702760379530.pdf";
"Content-Type" = "application/pdf; charset=UTF-8";
Date = "Sun, 16 Jan 2011 14:47:45 GMT";
Pragma = "";
Server = "AtyponWS/7.1";
"Transfer-Encoding" = Identity;
"X-Webstats-Respid" = b0324d930da3307597086eafb0e149c5;

有谁知道如何获取整个页面的大小,包括 pdf 或仅 pdf?

【问题讨论】:

    标签: objective-c nsurl


    【解决方案1】:

    看到这个:How to determine the size (in bytes) of a file downloading using NSURLConnection?

    你可以使用 NSURLResponse 方法

    [httpResponse expectedContentLength];
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-19
      • 1970-01-01
      • 2011-09-18
      • 1970-01-01
      • 1970-01-01
      • 2016-08-10
      • 1970-01-01
      • 2012-01-26
      相关资源
      最近更新 更多