I have Created one pdf with itext it Creates one page large pdf through Webview screenshot, but i want to split it in A4 size multiple pages with page number on bottom.

private void callDocument(File file, Bitmap screen) throws Exception {

    try {

        com.itextpdf.text.Rectangle pagesize = new com.itextpdf.text.Rectangle(webview.getWidth(), webview.getHeight());
        Document document = new Document(pagesize, 0f, 0f, 0f, 0f);
        PdfWriter.getInstance(document, new FileOutputStream(file));
        document.open();
        ByteArrayOutputStream stream = new ByteArrayOutputStream();
        screen.compress(Bitmap.CompressFormat.JPEG, 100, stream);
        byte[] byteArray = stream.toByteArray();
        addImage(document, byteArray);
        document.close();
        sendEmailToGuest();

    } catch (Exception e) {
        e.printStackTrace();
    }

}

Related posts

Recent Viewed