Preview PDF from file data

That depends on your use case. If the file can be embedded in the webview, then this is not necessary (e.g. for an image). But if the file should be opened natively, then it must also be available on the native file system.