import java.io.IOException;
import com.aspose.pdf.Document;
import com.aspose.pdf.TextAbsorber;
public class PDFTester {
private static final String pdf_license = "Aspose.Pdf.lic";
static {
//Initialize aspose PDF license
try {
com.aspose.pdf.License pdfLic = new com.aspose.pdf.License();
pdfLic.setLicense(pdf_license);
} catch (Exception e) {
}
}
public static void main(String[] args) throws IOException {
String extractedText = extractText("aspose_issue.pdf");
System.out.println(extractedText);
}
private static String extractText(String file) throws IOException{
Document pdfDocument = new Document(file);
// Create TextAbsorber object to extract text
TextAbsorber textAbsorber = new TextAbsorber();
// Accept the absorber for all the pages
pdfDocument.getPages().accept(textAbsorber);
// Get the extracted text
String extractedText = textAbsorber.getText();
return extractedText;
}
}
The console output of this is:
Lead Company: t3
Lead Createdby Name: Muthukrishnan Manoharan
Lead Email: t1@t3.com
Lead Firstname: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட
Lead Lastname: பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Lead Name: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Lead: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Lead Ownerid: 00590000002lqJ1AAI
Lead Phone: (989) 080-9809
Firstname: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட
Lastname: பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Contact Firstname: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட
Contact Lastname: பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Greetingcasual: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட
Greetingformal: Mr. பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Lead Fullname: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Contact Fullname: பபg0 嚡嵼歆悍賸澯袕榖匝炶媨央氫宔一டட பபg0 嚡牥搇梲椱粲拥傕豌襼瞫瑲掽睌一டட
Leadowner Companyname:CC
Notice the space between the characters