Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: android getting image from image's path and converting to PDF

teddy:

I am exporting the text and images to pdf. And it will be saved in the device memory. The text is exporting successfully. Am saving the image's path in database.So, if i export the images to pdf, it is showing the image's path. How to fetch image from image path and adding it to pdf document? Am doing the pdf function in the adapter. Please help me guys.

Here is my code:


public void addTitlePage(Document document,String date, String title, String content, String picture) throws DocumentException {
// Font Style for Document
Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18, Font.BOLD);
Font titleFont = new Font(Font.FontFamily.TIMES_ROMAN, 22, Font.BOLD
| Font.UNDERLINE, BaseColor.GRAY);
Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD);
Font normal = new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.NORMAL);

// Start New Paragraph
Paragraph prHead = new Paragraph();
// Set Font in this Paragraph
prHead.setFont(titleFont);
// Add item into Paragraph
prHead.add("All Memories");
//prHead.add(date + "\n");
// Create Table into Document with 1 Row
PdfPTable myTable = new PdfPTable(1);
// 100.0f mean width of table is same as Document size
myTable.setWidthPercentage(100.0f);

// Create New Cell into Table
PdfPCell myCell = new PdfPCell(new Paragraph(""));
myCell.setBorder(Rectangle.BOTTOM);

// Add Cell into Table
myTable.addCell(myCell);

prHead.setFont(catFont);
//prHead.add("\nName1 Name2\n");
prHead.setAlignment(Element.ALIGN_CENTER);

// Add all above details into Document
document.add(prHead);
document.add(myTable);

document.add(myTable);

// Now Start another New Paragraph
Paragraph prPersinalInfo = new Paragraph();
prPersinalInfo.setFont(smallBold);
prPersinalInfo.add(date+"\n");
prPersinalInfo.add(title+"\n");
prPersinalInfo.add(content+"\n");
prPersinalInfo.add(picture+"\n");





prPersinalInfo.setAlignment(Element.ALIGN_CENTER);

document.add(prPersinalInfo);
document.add(myTable);

document.add(myTable);

// Create new Page in PDF
document.newPage();
}



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: android getting image from image's path and converting to PDF

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×