当前位置: 首页>>代码示例>>Java>>正文


Java Document.addSubject方法代码示例

本文整理汇总了Java中com.itextpdf.text.Document.addSubject方法的典型用法代码示例。如果您正苦于以下问题:Java Document.addSubject方法的具体用法?Java Document.addSubject怎么用?Java Document.addSubject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.itextpdf.text.Document的用法示例。


在下文中一共展示了Document.addSubject方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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");
}
 
开发者ID:gonzapala,项目名称:CPI,代码行数:8,代码来源:generarPDF.java

示例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.");
}
 
开发者ID:Arquisoft,项目名称:Voting_2b,代码行数:8,代码来源:PDFLetterWriter.java

示例3: doInBackground

import com.itextpdf.text.Document; //导入方法依赖的package包/类
@Override
protected Exception doInBackground(String... photos) {
    try {
        // Get output Directory
        // Create the PDF and set some metadata
        Document document = new Document(PageSize.A4, DOCUMENT_MARGIN, DOCUMENT_MARGIN, DOCUMENT_MARGIN, DOCUMENT_MARGIN);
        Resources resources = mContext.getResources();
        document.addTitle(mFilename);
        document.addAuthor(resources.getString(R.string.app_name));
        document.addSubject(resources.getString(R.string.file_subject));
        // Open the file that we will write the pdf to.
        java.io.File fileContent = new java.io.File(ImageUtils.getAlbumStorageDir(MainActivity.ALBUM_NAME) + mFilename);
        OutputStream outputStream = new FileOutputStream(fileContent);
        PdfWriter.getInstance(document, outputStream);
        document.open();
        // Get the document's size
        Rectangle pageSize = document.getPageSize();
        float pageWidth = pageSize.getWidth() - (document.leftMargin() + document.rightMargin());
        float pageHeight = pageSize.getHeight();
        //Loop through images and add them to the document
        for (String path : photos) {
            Image image = Image.getInstance(path);
            image.scaleToFit(pageWidth, pageHeight);
            document.add(image);
            document.newPage();
        }
        // Cleanup
        document.close();
        outputStream.close();
        // Upload time!
        FileContent mediaContent = new FileContent("application/pdf", fileContent);
        File body = new File();
        if (mFolder != null)
            body.setParents(Arrays.asList(new ParentReference().setId(mFolder.getId())));
        body.setTitle(mFilename);
        body.setDescription(resources.getString(R.string.file_subject));
        body.setMimeType("application/pdf");
        Drive.Files.Insert insert = mService.files().insert(body, mediaContent);
        MediaHttpUploader uploader = insert.getMediaHttpUploader();
        uploader.setDirectUploadEnabled(false);
        uploader.setChunkSize(MediaHttpUploader.MINIMUM_CHUNK_SIZE);
        uploader.setProgressListener(new FileProgressListener());
        File file = insert.execute();
        Log.d("C2P", "File Id: " + file.getId());
        /* Database Code */
        DateFormat format = new SimpleDateFormat("MM/dd/yyyy");
        Date date = new Date();
        //file.getFileSize().toString()
        String parentFolder = mFolder != null ? mFolder.getId() : "root";
        Long size = file.getFileSize();
        String fileSizeString = humanReadableByteCount(size);
        Upload upload = new Upload(-1, mFilename, mFolderPath, fileSizeString, parentFolder, format.format(date), mService.about().get().execute().getUser().getEmailAddress());
        UploadDataAdapter mUploadDataAdapter = new UploadDataAdapter(mContext);
        mUploadDataAdapter.open();
        mUploadDataAdapter.addUpload(upload);
        mUploadDataAdapter.close();
    } catch (Exception e) {
        Log.d("C2P", "ERROR", e);
        return e;
    }
    return null;
}
 
开发者ID:rockwotj,项目名称:Cam2PDF,代码行数:63,代码来源:UpvertTask.java

示例4: 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;
    }
 
开发者ID:dovier,项目名称:coj-web,代码行数:51,代码来源:BasePdf.java


注:本文中的com.itextpdf.text.Document.addSubject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。