當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。