如何在SQLite中保存pdf文件 [英] how to save pdf file in SQLite

查看:67
本文介绍了如何在SQLite中保存pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序中,我有pdf文件.我想将这些pdf文件保存到我的数据库中.我正在使用SQLite作为后端.如何将这些pdf文件格式化为字节.

in my application, I have pdf files. I want to save those pdf files into my database. I am using SQLite as my Backend. How can I format those pdf file into bytes.

推荐答案

您可以简单地读取pdf文件的所有字节并将其存储在sqlite DB的blob字段中,但是强烈建议您使用以下更好的解决方案:内部存储器和数据库中的文件仅存储文件的路径.您还必须检查是否有足够的内存存储空间供您使用.

You can simply read all the bytes of the pdf file and store them in the blob field of sqlite DB, but a better solution which is highly recommended is to store the files on the Internal Storage and in your DB just store the file's path. You have also to check if there is enough memory storage for you.

这篇关于如何在SQLite中保存pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆