Examples of PDFDocument


Examples of com.itextpdf.text.pdf.PdfDocument

    public void setBottomMargin(float margin) {             // VIKTORZ ++
        this.marginBottom = margin;                         // VIKTORZ ++
        for (DocListener listener : listeners) {            // VIKTORZ ++
            if (listener instanceof PdfDocument) {          // VIKTORZ ++
                PdfDocument pdfdoc = (PdfDocument)listener; // VIKTORZ ++
    pdfdoc.setBottomMargin(margin);             // VIKTORZ ++
            }                                               // VIKTORZ ++
        }                                                   // VIKTORZ ++
    }                                                       // VIKTORZ ++
View Full Code Here

Examples of com.orsonpdf.PDFDocument

              if (!fileName.endsWith(".pdf")) {
                fileName = fileName + ".pdf";
              }
              File f = new File(fileDialog.getDirectory(),
                  fileName);
              PDFDocument document = new PDFDocument();
              document.setAuthor("ECJ Console");
              Page page = document.createPage(new Rectangle(
                  width, height));
              Graphics2D g2 = page.getGraphics2D();
              Rectangle2D rectangle2D = new Rectangle2D.Double(0,
                  0, width, height);
              chart.draw(g2, rectangle2D);
              g2.dispose();
              document.writeToFile(f);
            }
          } catch (Exception ex)

          {
            ex.printStackTrace();
View Full Code Here

Examples of nz.govt.natlib.adapter.pdf.dom.PDFDocument

    writeFileInfo(oFile, ctx);
    try {
      InputStream in = new FileInputStream(oFile);
      ctx.fireStartParseEvent("pdf-meta");
      // the first thing to do is to open a PDF 'Stream'
      PDFDocument doc = new PDFDocument(oFile, null); // if we could pass
                              // passwords there
                              // is where to do
                              // it...

      String idBase = doc.getIdBase();
      ctx.fireParseEvent("doc-id", doc.getIdBase());
      ctx.fireParseEvent("iteration-id", doc.getIdIteration());
      if (idBase == null) {
        ctx.fireParseEvent("original", "unknown");
      } else {
        ctx.fireParseEvent("original", doc.getIdIteration().equals(
            idBase));
      }

      fireSpecialNull(ctx, "title", doc.getTitle());
      fireSpecialNull(ctx, "language", doc.getLanguage());
      fireSpecialNull(ctx, "author", doc.getAuthor());
      fireSpecialNull(ctx, "creator", doc.getCreator());
      fireSpecialNull(ctx, "subject", doc.getSubject());
      fireSpecialNull(ctx, "producer", doc.getProducer());
      fireSpecialNull(ctx, "keywords", doc.getKeywords());

      // created...
      SimpleDateFormat dateFormatter = new SimpleDateFormat();
      Date date = doc.getCreationDate();
      ctx.fireStartParseEvent("creation-date");
      if (date != null) {
        dateFormatter.applyPattern(FXUtil.dateFormat);
        ctx.fireParseEvent("DATE", dateFormatter.format(date));
        ctx.fireParseEvent("DATEPATTERN", FXUtil.dateFormat);
        dateFormatter.applyPattern(FXUtil.timeFormat);
        ctx.fireParseEvent("TIME", dateFormatter.format(date));
        ctx.fireParseEvent("TIMEPATTERN", FXUtil.timeFormat);
      } else {
        ctx.fireParseEvent("unavailable");
      }
      ctx.fireEndParseEvent("creation-date");

      // modified
      date = doc.getModificationDate();
      ctx.fireStartParseEvent("modified-date");
      if (date != null) {
        dateFormatter.applyPattern(FXUtil.dateFormat);
        ctx.fireParseEvent("DATE", dateFormatter.format(date));
        ctx.fireParseEvent("DATEPATTERN", FXUtil.dateFormat);
        dateFormatter.applyPattern(FXUtil.timeFormat);
        ctx.fireParseEvent("TIME", dateFormatter.format(date));
        ctx.fireParseEvent("TIMEPATTERN", FXUtil.timeFormat);
      } else {
        ctx.fireParseEvent("unavailable");
      }
      ctx.fireEndParseEvent("modified-date");

      ctx.fireParseEvent("has-forms", doc.hasForms());
      ctx.fireParseEvent("has-metadata-stream", doc.hasMetadataStream());
      ctx.fireParseEvent("has-outine", doc.hasOutline());
      ctx.fireParseEvent("has-threads", doc.hasThreads());
      ctx.fireParseEvent("tagged", doc.isTagged());
      fireSpecialNull(ctx, "page-layout", doc.getPageLayout());
      fireSpecialNull(ctx, "page-mode", doc.getPageMode());
      fireSpecialNull(ctx, "trapped", doc.getTrapped());
      fireSpecialNull(ctx, "version", doc.getVersion());

      boolean encrypted = doc.isEncrypted();
      ctx.fireStartParseEvent("security");
      ctx.fireParseEvent("encrypted", encrypted);
      if (encrypted) {
        fireSpecialNull(ctx, "scheme", doc.getScheme());
        fireSpecialNull(ctx, "scheme-type", doc.getSchemeType());
        ctx.fireParseEvent("key-length", doc.getKeyLength());
        ctx.fireParseEvent("readonly", doc.isReadOnly());
        ctx.fireParseEvent("allow-print", doc.allowPrint());
        ctx.fireParseEvent("allow-copy", doc.allowCopy());
        ctx.fireParseEvent("allow-notes", doc.allowTextNotes());
        ctx.fireParseEvent("user-password", doc.hasUserPassword());
        ctx.fireParseEvent("owner-password", doc.hasOwnerPassword());
      }
      ctx.fireEndParseEvent("security");

      doc.close();
      ctx.fireEndParseEvent("pdf-meta");
      in.close();
    } catch (Exception ex) {
      throw new RuntimeException(ex);
    } finally {
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

     * @param cfg the configuration
     * @throws ConfigurationException if an error occurs while configuring the object
     */
    public void configure(PDFDocumentGraphics2D graphics, Configuration cfg)
            throws ConfigurationException {
        PDFDocument pdfDoc = graphics.getPDFDocument();
       
        //Filter map
        pdfDoc.setFilterMap(
                PDFRendererConfigurator.buildFilterMapFromConfiguration(cfg));
       
        //Fonts
        try {
            FontResolver fontResolver = FontSetup.createMinimalFontResolver();
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

     * using curves and not the font.
     */
    public PDFDocumentGraphics2D(boolean textAsShapes) {
        super(textAsShapes);

        this.pdfDoc = new PDFDocument("Apache FOP Version " + Version.getVersion()
                + ": PDFDocumentGraphics2D");
        this.pdfContext = new PDFContext();
    }
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

    public void startRenderer(OutputStream stream) throws IOException {
        if (userAgent == null) {
            throw new IllegalStateException("UserAgent must be set before starting the renderer");
        }
        ostream = stream;
        this.pdfDoc = new PDFDocument(
                userAgent.getProducer() != null ? userAgent.getProducer() : "");
        this.pdfDoc.getProfile().setPDFAMode(this.pdfAMode);
        this.pdfDoc.getProfile().setPDFXMode(this.pdfXMode);
        this.pdfDoc.getInfo().setCreator(userAgent.getCreator());
        this.pdfDoc.getInfo().setCreationDate(userAgent.getCreationDate());
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

        assertEquals(cal1.getTime(), info.getCreationDate());
        assertEquals(cal2.getTime(), info.getModDate());
    }
   
    public void testXMPUpdate() throws Exception {
        PDFDocument doc = new PDFDocument("SuperFOP");
        PDFInfo info = doc.getInfo();
        info.setTitle("MyTitle");
        info.setSubject("MySubject");
        info.setAuthor("That's me");
        info.setKeywords("XSL-FO XML");
        //info.setProducer("SuperFOP");
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

    public PDFXObject generateImage(RendererContext context, Image image,
            Point origin, Rectangle pos)
            throws IOException {
        PDFRenderer renderer = (PDFRenderer)context.getRenderer();
        ImageRawJPEG jpeg = (ImageRawJPEG)image;
        PDFDocument pdfDoc = (PDFDocument)context.getProperty(
                PDFRendererContextConstants.PDF_DOCUMENT);
        PDFResourceContext resContext = (PDFResourceContext)context.getProperty(
                PDFRendererContextConstants.PDF_CONTEXT);
       
        PDFImage pdfimage = new ImageRawJPEGAdapter(jpeg, image.getInfo().getOriginalURI());
        PDFXObject xobj = pdfDoc.addImage(resContext, pdfimage);

        float x = (float)pos.getX() / 1000f;
        float y = (float)pos.getY() / 1000f;
        float w = (float)pos.getWidth() / 1000f;
        float h = (float)pos.getHeight() / 1000f;
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

     * @param cfg the configuration
     * @throws ConfigurationException if an error occurs while configuring the object
     */
    public void configure(PDFDocumentGraphics2D graphics, Configuration cfg)
            throws ConfigurationException {
        PDFDocument pdfDoc = graphics.getPDFDocument();
       
        //Filter map
        pdfDoc.setFilterMap(
                PDFRendererConfigurator.buildFilterMapFromConfiguration(cfg));
       
        //Fonts
        try {
            FontResolver fontResolver = FontSetup.createMinimalFontResolver();
View Full Code Here

Examples of org.apache.fop.pdf.PDFDocument

     * using curves and not the font.
     */
    public PDFDocumentGraphics2D(boolean textAsShapes) {
        super(textAsShapes);

        this.pdfDoc = new PDFDocument("Apache FOP Version " + Version.getVersion()
                + ": PDFDocumentGraphics2D");
        this.pdfContext = new PDFContext();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.