Most, if not all, tutorials use CGPDFDocumentCreateWithURL(). What is the difference if using CGPDFDocumentCreateWithProvider() instead? Let's say the pdf is being taken from a local file on the device, not downloaded from some website. Will there be a performance difference? Which is better?
views:
15answers:
1
A:
The most direct approach will be to use CGPDFDocumentCreateWithURL()
with a file URL. To use CGPDFDocumentCreateWithProvider()
, you will just have to create a provider from the file (or worse, read it all into an NSData
, then wrap that in the provider), then create the document with the provider.
The only way to tell if there's a performance difference is to do both and then profile each for the workload you'll be applying them to.
Jeremy W. Sherman
2010-10-22 02:45:17
Thanks. So, when is it more appropriate to use CGPDFDocumentCreateWithProvider()?
Altealice
2010-10-22 04:22:10
When your code is already dealing with a provider for one reason or another, or you can't provide a URL for your data. For example, if you've built up a PDF document in memory, and you want to use that buffer to supply data to the CGPDFDocument, then you would wrap the buffer in a provider and use that to create the CGPDFDocument rather than writing the buffer to disk and then loading it from there.
Jeremy W. Sherman
2010-10-22 15:11:20