本文整理汇总了Java中com.itextpdf.text.Document.addCreator方法的典型用法代码示例。如果您正苦于以下问题:Java Document.addCreator方法的具体用法?Java Document.addCreator怎么用?Java Document.addCreator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.itextpdf.text.Document
的用法示例。
在下文中一共展示了Document.addCreator方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addMetaData
import com.itextpdf.text.Document; //导入方法依赖的package包/类
private static void addMetaData(Document document) {
document.addTitle("My first PDF");
document.addSubject("Using iText");
document.addKeywords("Java, PDF, iText");
document.addAuthor("Lars Vogel");
document.addCreator("Lars Vogel");
}
示例2: putPdfInfo
import com.itextpdf.text.Document; //导入方法依赖的package包/类
private void putPdfInfo(Document document) {
document.addAuthor("AswCensuses2B");
document.addCreationDate();
document.addCreator("AswCensuses2B.com");
document.addTitle("Personal Voter Letter");
document.addSubject("A pdf file with your password and user at the online service.");
}
示例3: makePDF
import com.itextpdf.text.Document; //导入方法依赖的package包/类
private static void makePDF(Bitmap bmp, File file) {
Document document = new Document();
try {
PdfWriter.getInstance(document, new FileOutputStream(file));
document.addAuthor(FullscreenActivity.mAuthor.toString());
document.addTitle(FullscreenActivity.mTitle.toString());
document.addCreator("OpenSongApp");
if (bmp!=null && bmp.getWidth()>bmp.getHeight()) {
document.setPageSize(PageSize.A4.rotate());
} else {
document.setPageSize(PageSize.A4);
}
document.addTitle(FullscreenActivity.mTitle.toString());
document.open();//document.add(new Header("Song title",FullscreenActivity.mTitle.toString()));
BaseFont urName = BaseFont.createFont("assets/fonts/Lato-Reg.ttf", "UTF-8",BaseFont.EMBEDDED);
Font TitleFontName = new Font(urName, 14);
Font AuthorFontName = new Font(urName, 10);
document.add(new Paragraph(FullscreenActivity.mTitle.toString(),TitleFontName));
document.add(new Paragraph(FullscreenActivity.mAuthor.toString(),AuthorFontName));
addImage(document,bmp);
document.close();
} catch (Exception e) {
e.printStackTrace();
}
}
示例4: renderGraph
import com.itextpdf.text.Document; //导入方法依赖的package包/类
@Override
public void renderGraph(JGraph<?> graph, File file) throws PortException {
// Get graph bounds. If not available, do nothing (probably empty graph)
Rectangle2D bounds = graph.getGraphBounds();
if (bounds == null) {
return;
}
Rectangle bound = new Rectangle((float) bounds.getWidth(), (float) bounds.getHeight());
try (FileOutputStream fos = new FileOutputStream(file)) {
Document document = new Document(bound);
// Open file, create PDF document
PdfWriter writer = PdfWriter.getInstance(document, fos);
// Set some metadata
document.addCreator(Version.getAbout());
// Open document, get graphics
document.open();
PdfContentByte cb = writer.getDirectContent();
boolean onlyShapes = true;
//The embedded fonts most likely do not contain all necessary glyphs, so using outlines instead
// onlyShapes makes PDF considerably bigger, but no alternative at the moment
PdfGraphics2D pdf2d =
new PdfGraphics2D(cb, (float) bounds.getWidth(), (float) bounds.getHeight(),
new DefaultFontMapper(), onlyShapes, false, (float) 100.0);
// Render
toGraphics(graph, pdf2d);
// Cleanup
pdf2d.dispose();
document.close();
} catch (DocumentException | IOException e) {
throw new PortException(e);
}
}
示例5: generarPdf
import com.itextpdf.text.Document; //导入方法依赖的package包/类
protected File generarPdf(String author, String creator, String subject, String title, String contenido, String ruta, boolean concat) {
Document document = new Document(PageSize.A4, 35, 30, 70, 50);
FileOutputStream fileO;
File file = new File(ruta);
if (!file.exists()) {
try {
if (concat) {
fileO = new FileOutputStream(new File(ruta));
} else {
fileO = new FileOutputStream(ruta);
}
PdfWriter writer = PdfWriter.getInstance(document, fileO);
writer.setBoxSize("art", new Rectangle(36, 54, 559, 788));
HeaderFooter event = new HeaderFooter();
writer.setPageEvent(event);
document.open();
if (!concat) {
document.addAuthor(author);
document.addCreator(creator);
document.addSubject(subject);
document.addCreationDate();
document.addTitle(title);
}
contenido = procesarHtml(contenido);
HTMLWorker htmlWorker = new HTMLWorker(document);
if (concat) {
htmlWorker.newPage();
}
htmlWorker.parse(new StringReader(contenido));
document.close();
File file1 = new File(ruta);
return file1;
} catch (Exception e) {
return null;
}
}
return file;
}