在android中以pdf格式显示sqlite数据库内容

Nam*_*lay 5 pdf sqlite android

我在Android中有一个Sqlite数据库,我希望通过按下按钮在Android中动态构建它来在PDF文件中显示其内容.

我知道iText,但我想用更简单的解决方案..任何人都可以帮助我PLZ !!

pra*_*upd 5

查看droidtext,它是iText库2.1.7 for Android的一个端口.

还有很多例子.开始使用Helloworld.

public class HelloWorld {

        /**
         * Generates a PDF file with the text 'Hello World'
         * 
         * @param args
         *            no arguments needed here
         */
        public static void main(String[] args) {

                System.out.println("Hello World");

                // step 1: creation of a document-object
                Document document = new Document();
                try {
                        // step 2:
                        // we create a writer that listens to the document
                        // and directs a PDF-stream to a file
                        PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "HelloWorld.pdf"));

                        // step 3: we open the document
                        document.open();
                        // step 4: we add a paragraph to the document
                        document.add(new Paragraph("Hello World"));
                } catch (DocumentException de) {
                        System.err.println(de.getMessage());
                } catch (IOException ioe) {
                        System.err.println(ioe.getMessage());
                }

                // step 5: we close the document
                document.close();
        }
}
Run Code Online (Sandbox Code Playgroud)


Nam*_*lay 0

我在fpdf 教程的帮助下完成了 php 中的 PDF 实现。有了这个,我还获得了饼图和条形图的帮助,以便在我的 pdf 中进行图形表示。此外,这种格式还简化了将 pdf 文件作为附件邮寄的过程,因为它可以以多种方式存储。