Load PDF from documents directory - iPhone

后端 未结 3 438
小鲜肉
小鲜肉 2021-01-27 21:44

Instead of loading a PDF from the resources folder I would like to load it from the documents directory. I have been trying to do this for days but the CGPDFDocumentRef keeps

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-27 22:27

    You probably don't have a PDF file at that path. The “Create” in CGPDFDocumentCreateWithURL refers to the CGPDFDocument object; it will not create a document file at that URL. You can only create a CGPDFDocument object for a PDF file that already exists.

    Also, as I mentioned on your other question, I don't see why you're trying to delete “localhost/” from the path. It's unlikely to exist there in the first place (it's more likely to only appear in the URL), and if it ever does appear there, it should appear there, and stripping it out will make the path wrong.

提交回复
热议问题