小编Nik*_*hil的帖子

在 Android 中使用 Recyclerview(里面的整个项目)中的 iText 创建 PDF 文件?

您好,我正在尝试使用iText库从 Recyclerview 创建 PDF 输出文件。经过几个小时的努力,我能够从 recyclerview 创建 PDF。

以下是我用来创建 PDF 的类

主类的代码

     private void getPrint() {


    ArrayList<View> viewArrayList = mAdapter.getPrintView(); // A function from Adapter class which returns ArrayList of VIEWS
    Document document = new Document(PageSize.A4);
    final File file = new File(getStorageDir("PDF"), "print.pdf");
    try {
        PdfWriter.getInstance(document, new FileOutputStream(file));
    } catch (DocumentException | FileNotFoundException e) {
        e.printStackTrace();
    }

    for (int im = 0; im < viewArrayList.size(); im++) {
        // Iterate till the last of the array list and add each …
Run Code Online (Sandbox Code Playgroud)

java pdf android itext

2
推荐指数
1
解决办法
4215
查看次数

如何访问工具:来自Kotlin/Java类的示例数据?

示例数据是Android Studio团队的一项重大发明.它使设计开发变得非常简单.所以我的实际问题是,我们如何从Java/Kotlin类而不是XML访问样本数据.

android android-layout kotlin

0
推荐指数
1
解决办法
93
查看次数

标签 统计

android ×2

android-layout ×1

itext ×1

java ×1

kotlin ×1

pdf ×1