![JAR search and dependency download from the Maven repository](/logo.png)
com.lowagie.tools.TabHandling Maven / Gradle / Ivy
package com.lowagie.tools;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Path;
import java.nio.file.Paths;
import com.lowagie.text.Chunk;
import com.lowagie.text.Document;
import com.lowagie.text.FontFactory;
import com.lowagie.text.PageSize;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.parser.PdfTextExtractor;
public class TabHandling {
public static void main(String[] args) throws IOException {
Document document = new Document(PageSize.A4);
final Path target = Paths.get("target", TabHandling.class.getName() + ".pdf");
final FileOutputStream stream = new FileOutputStream(target.toFile());
PdfWriter.getInstance(document, stream);
document.open();
document.add(new Chunk("RAJ\tVIHAR", FontFactory.getFont(FontFactory.TIMES, "ASCII")));
document.close();
PdfReader reader = new PdfReader(target.toString());
PdfTextExtractor extractor = new PdfTextExtractor(reader);
final String textFromPage = extractor.getTextFromPage(1);
System.out.println("TfP: '" + textFromPage + "'");
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy