Reading a pdf file using the iText library

I am new to android. I planned to develop a PDF viewer. I heard that there is a library available called iText for developing a PDF viewer. Tell me how to use the iText library with Android and how to develop an application using this library.

+1
source share
1 answer

try it

public class ReadAndUsePdf { private static String INPUTFILE = "c:/temp/FirstPdf.pdf"; private static String OUTPUTFILE = "c:/temp/ReadPdf.pdf"; public static void main(String[] args) throws DocumentException, IOException { Document document = new Document(); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(OUTPUTFILE)); document.open(); PdfReader reader = new PdfReader(INPUTFILE); int n = reader.getNumberOfPages(); PdfImportedPage page; // Go through all pages for (int i = 1; i <= n; i++) { // Only page number 2 will be included if (i == 2) { page = writer.getImportedPage(reader, i); Image instance = Image.getInstance(page); // here you can show image on your phone } } document.close(); } } 
+4
source

Source: https://habr.com/ru/post/1396604/


All Articles