本文整理匯總了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;
}