How to print RecyclerView content in a PDF file from your Android App? - Android 13 | API 33

preview_player
Показать описание
In this video it shows steps to print the content of the recycler view content (images) in a PDF file page.

In this the Android App is developed in Android studio for Android 13 API 33 version.

It re-uses the recycler view part of code from my previously published video. The code is also available in the below link:

Complete source code and other details/ steps of this video are posted in the below link:

However, the main Java code is copied below also for reference:

public class MainActivity extends AppCompatActivity {

private RecyclerView recyclerView;
private RecyclerView.LayoutManager layoutManagerRecyclerView;
private RecyclerViewCustomAdapter recyclerViewCustomAdapter;
private File filePDFOutput;

@Override
protected void onCreate(Bundle savedInstanceState) {

new String[]{READ_MEDIA_IMAGES, WRITE_EXTERNAL_STORAGE},
PackageManager.PERMISSION_GRANTED);

// Liner Layout
// GRID Layout


StorageManager storageManager = (StorageManager) getSystemService(STORAGE_SERVICE);

Bitmap[] bitmaps = {bitmap, bitmap1};
recyclerViewCustomAdapter = new RecyclerViewCustomAdapter(bitmaps);

}

public void buttonPrint(View view) throws IOException {
PdfDocument pdfDocument = new PdfDocument();
1).create();

}
}

--
Рекомендации по теме
Комментарии
Автор

what about multiple pages for longer recyclerview

VenuGopal.Pottangi
Автор

Hi for min sdk of 24 it doesn't work.. Do you have any other solution for this?

sonkemedia
Автор

Does anyone knows
80mm 3 inches print option, save as pdf, print preview, share receipt also it will be very useful for business people like me ❤
scrollable page for 80mm width and height may vary with the content

JC-dkmk