We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can i print pdf file? Can you please add the pdf print support?
The text was updated successfully, but these errors were encountered:
you can convert pdf to bitmap and print bitmap.
private ArrayList<Bitmap> pdfToBitmap(File pdfFile) { ArrayList<Bitmap> bitmaps = new ArrayList<>(); try { PdfRenderer renderer = new PdfRenderer(ParcelFileDescriptor.open(pdfFile, ParcelFileDescriptor.MODE_READ_ONLY)); Bitmap bitmap; final int pageCount = renderer.getPageCount(); for (int i = 0; i < pageCount; i++) { PdfRenderer.Page page = renderer.openPage(i); float ratio = 2.6f; float width = ratio * page.getWidth(); float height = ratio * page.getHeight(); bitmap = Bitmap.createBitmap((int) width, (int) height, Bitmap.Config.ARGB_8888); page.render(bitmap, null, null, PdfRenderer.Page.RENDER_MODE_FOR_DISPLAY); bitmaps.add(bitmap); // close the page page.close(); } // close the renderer renderer.close(); } catch (Exception ex) { ex.printStackTrace(); } return bitmaps; }
the ratio value depends on your pdf width. I came with this amount with testing.
ratio
Sorry, something went wrong.
No branches or pull requests
How can i print pdf file?
Can you please add the pdf print support?
The text was updated successfully, but these errors were encountered: