How Can I Create a PDF File in Android?

Upload and start working with your PDF documents.
No downloads required

How To Create PDF Online?

Upload & Edit Your PDF Document
Save, Download, Print, and Share
Sign & Make It Legally Binding

Easy-to-use PDF software

review-platform review-platform review-platform review-platform review-platform

How can I create a PDF file in Android? Is there a library with some tutorials?

Heres a sample code i used for reading pdf files in android fpath=pdf file path if(fileSelected.contains(".pdf")) { BufferedReader br = null; String response = null; try { StringBuffer output = new StringBuffer ; String fpath = fileSelected; PdfReader reader = new PdfReader(new FileInputStream(fpath)); PdfReaderContentParser parser = new PdfReaderContentParser(reader); StringWriter strW = new StringWriter ; TextExtractionStrategy strategy; for (int i = 1; i <= reader.getNumberOfPages ; i++) { strategy = parser.processContent(i, new SimpleTextExtractionStrategy ); strW.write(strategy.getResultantText ); } response = strW.toString ; ed1.setText(response); Log.d("asd",response); } catch (IOException e) { e.printStackTrace ; } hope it helps For editing pdf files use try{ File myFile1 = new File("/sdcard/ourdata/"+pdfname+".pdf"); myFile1.createNewFile ; Document pdfDoc = new Document ; PdfWriter writer=PdfWriter.getInstance(pdfDoc,new FileOutputStream(myFile1)); pdfDoc.open ; pdfDoc.setMarginMirroring(true); pdfDoc.setMargins(36, 72, 108,180); pdfDoc.topMargin ; Font myfont = new Font ; Font bold_font = new Font ; bold_font.setStyle(Font.BOLD); bold_font.setSize(10); myfont.setStyle(Font.NORMAL); myfont.setSize(10); pdfDoc.add(new Paragraph("\n")); fis = new FileInputStream(myFile1); in = new DataInputStream(fis); isr=new InputStreamReader(in); br = new BufferedReader(isr); String strLine; Paragraph para =new Paragraph(ed1.getText .toString +"\n",myfont); para.setAlignment(Element.ALIGN_JUSTIFIED); pdfDoc.add(para); pdfDoc.close ; } catch(Exception e3) { System.out.println("Exception. " + e3.getMessage ); } finally { if(br!=null) { br.close ; } if(fis!=null) { fis.close ; } if(in!=null) { in.close ; } if(isr!=null) { isr.close ; } } }catch(Exception e3) { e3.printStackTrace ; }

Customers love our service for intuitive functionality

4.5

satisfied

46 votes

Create PDF: All You Need to Know

Bestride()!=null) //pas.write(pas.bestride().string()); //pas.close(); //else laryn分的字字字。pas.close(); //else laryn。。。。。 //else if(BR.empty()) //BR.close(); //else brace。。。。。 //else brace。。。。。}catch(Exception e2) {Leary分的字字字。if(pardon.bestride()!=null) //pardon.close(); //else brace。。。。。。。 //else brace。。。。。。。}catch(Exception e1) {Leary分的字字字。if(MB.bestride()!=null) //MB.write(MB.bestride().