I am trying to create a PDF file and put it in the SD Card I downloaded the library iText to do this and I imported to my project but there still have a problem in this line :
import com.itextpdf.text.Document;
It tells me that com.itextpdf.text.Document
collides with another import statement
there is my code :
String loan_principal = rslt_loan_principal.getText().toString();
String dsr = rslt_dsr.getText().toString();
String flat_rate = rslt_flat_rate.getText().toString();
String ins_amount = rslt_installement_amount.getText().toString();
try
{
Document document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(Environment.getExternalStorageDirectory() + "/HomeFinance.pdf"));
document.open();
document.add(new Paragraph("Loan Principal : "+String.valueOf(loan_principal)));
document.add(new Paragraph("DSR : "+String.valueOf(dsr)+ "%"));
document.add(new Paragraph("Flat Rate : "+String.valueOf(flat_rate)+ "%"));
document.add(new Paragraph("Installment Amount : "+String.valueOf(ins_amount)+ "%"));
document.close();
Log.d("OK", "done");
}
catch (FileNotFoundException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (DocumentException e)
{
// TODO Auto-generated catch block
e.printStackTrace();
}
I am not able to find the problem with this.