Created
October 18, 2017 13:37
-
-
Save nuxlight/174cefd78ad729cdc4c8dfce25abce5b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.pdfbox.pdmodel.PDDocument; | |
import org.apache.pdfbox.pdmodel.PDPage; | |
import org.apache.pdfbox.pdmodel.PDPageContentStream; | |
import org.apache.pdfbox.pdmodel.common.PDStream; | |
import org.apache.pdfbox.pdmodel.font.PDFont; | |
import org.apache.pdfbox.pdmodel.font.PDType1Font; | |
import java.io.File; | |
import java.io.IOException; | |
public class app { | |
public static void main(String[] args) throws IOException { | |
PDDocument document = new PDDocument(); | |
PDPage page = new PDPage(); | |
document.addPage(page); | |
PDPageContentStream contentStream = new PDPageContentStream(document, page); | |
contentStream.beginText(); | |
contentStream.setFont(PDType1Font.TIMES_ROMAN, 16); | |
contentStream.showText("lorem sldkfsdkfdsfdsf"); | |
contentStream.endText(); | |
contentStream.close(); | |
document.save(new File("doc.pdf")); | |
document.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment