Examples of PdfFile


Examples of com.itextpdf.rups.model.PdfFile

  @Override
  public void notifyObservers(Object obj) {
    if (obj instanceof FileChooserAction) {
      File file = ((FileChooserAction)obj).getFile();
      try {
        pdfFile = new PdfFile(file);
        setChanged();
        super.notifyObservers(RupsMenuBar.OPEN);
        readerController.startObjectLoader(pdfFile);
      }
      catch(IOException ioe) {
View Full Code Here

Examples of com.lowagie.rups.model.PdfFile

  @Override
  public void notifyObservers(Object obj) {
    if (obj instanceof FileChooserAction) {
      File file = ((FileChooserAction)obj).getFile();
      try {
        pdfFile = new PdfFile(file);
        setChanged();
        super.notifyObservers(RupsMenuBar.OPEN);
        renderer.startPageLoader(pdfFile);
        reader.startObjectLoader(pdfFile);
      }
View Full Code Here

Examples of com.lowagie.rups.model.PdfFile

  @Override
  public void notifyObservers(Object obj) {
    if (obj instanceof FileChooserAction) {
      File file = ((FileChooserAction)obj).getFile();
      try {
        pdfFile = new PdfFile(file);
        setChanged();
        super.notifyObservers(RupsMenuBar.OPEN);
        readerController.startObjectLoader(pdfFile);
      }
      catch(IOException ioe) {
View Full Code Here

Examples of com.sun.pdfview.PDFFile

                                                      ISBN.isISBN13(s) ? s : null);
                }
               
               
                RandomAccessFile raf = null;
                PDFFile pdffile;
                try {
                   
                    raf = new RandomAccessFile(file, "r");
                    FileChannel channel = raf.getChannel();
                    ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
                    pdffile = new PDFFile(buf);
                    pdffile.stop(1);
   
                    try {
                        book.setValue(Book._T_NROFPAGES, Long.valueOf(pdffile.getNumPages()));
                        Iterator<String> it = pdffile.getMetadataKeys();
                        while (it.hasNext()) {
                            String key = it.next();
                            String value = pdffile.getStringMetadata(key);
                           
                            if (!Utilities.isEmpty(value)) {
                                if (key.equalsIgnoreCase("Author"))
                                    DataManager.createReference(book, Book._G_AUTHOR, value);
                                if (key.equalsIgnoreCase("Title") && !value.trim().equalsIgnoreCase("untitled"))
                                    book.setValue(Book._A_TITLE, value);
                            }
                        }
                    } catch (IOException ioe) {
                        getClient().addMessage(DcResources.getText("msgCouldNotReadInfoFrom", filename));
                    }
   
                    // draw the first page to an image
                    PDFPage page = pdffile.getPage(0);
                    if (page != null) {
                        Rectangle rect = new Rectangle(0,0, (int)page.getBBox().getWidth(), (int)page.getBBox().getHeight());
                        Image front = page.getImage(rect.width, rect.height, rect, null, true, true);
                        book.setValue(Book._K_PICTUREFRONT, new DcImageIcon(Utilities.getBytes(new DcImageIcon(front))));
                    }
View Full Code Here

Examples of com.sun.pdfview.PDFFile

      // load a pdf from a byte buffer
      File file = new File(options.getInFile());
      RandomAccessFile raf = new RandomAccessFile(file, "r");
      FileChannel channel = raf.getChannel();
      ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
      PDFFile pdffile = null;
      try {
        // try to read PDF without password
        pdffile = new PDFFile(buf);
      } catch (PDFParseException ppe) {
        try {
          // try to read PDF with empty password
          pdffile = new PDFFile(buf, new PDFPassword(""));
        } catch (PDFParseException ppe2) {
          // try to read PDF with owner password
          pdffile = new PDFFile(buf, new PDFPassword(options.getPdfOwnerPwdStr()));
        }
      }

      // draw the page to an image
      PDFPage page = pdffile.getPage(aPage);

      // get the width and height for the doc at the default zoom
      Rectangle rect = new Rectangle(0, 0, (int) page.getBBox().getWidth(), (int) page.getBBox().getHeight());

      // generate the image
View Full Code Here

Examples of com.sun.pdfview.PDFFile

    raf = new RandomAccessFile(manualFile, "r");

    FileChannel fc = raf.getChannel();
    ByteBuffer buf = fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
    pdfFile = new PDFFile(buf);

    pageStart = 0;
    pageEnd = pdfFile.getNumPages();
    OutlineNode on = pdfFile.getOutline();
    if (on != null) {
View Full Code Here

Examples of com.sun.pdfview.PDFFile

      pdf = workAround();
    }
    // reading the file into SUN's PDFFile
    pdf.reOpen();
    try {
      PDFFile = new PDFFile(pdf.getNioByteBuffer());
    }
    catch(IOException ioe) {
      PDFFile = new PDFFile(workAround().getNioByteBuffer());
    }
    pdf.close();
   
  }
View Full Code Here

Examples of com.sun.pdfview.PDFFile

        try {
            RandomAccessFile raf = new RandomAccessFile(new File(path), "r");
            FileChannel channel = raf.getChannel();
            ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0,
                    channel.size());
            PDFFile pdffile = new PDFFile(buf);
            PDFPage page = pdffile.getPage(0, true);
            Rectangle2D bb = page.getBBox();
            int width = bb == null ? (int) page.getWidth() : (int) bb.getWidth();
            int height = bb == null ? (int) page.getHeight() : (int) bb.getHeight();
            Rectangle rect = new Rectangle(0, 0, width, height);
            BufferedImage img = (BufferedImage) page.getImage(rect.width,
View Full Code Here

Examples of com.sun.pdfview.PDFFile

    try {

      channel = openFileChannel();

      PDFFile pdf = openPdfFile(channel);

      List<AttachmentPage> res = openAllPages(pdf);

      return res;
View Full Code Here

Examples of com.sun.pdfview.PDFFile

    return stream.getChannel();
  }

  private PDFFile openPdfFile(FileChannel channel) throws IOException {
    ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
    return new PDFFile(buf);
  }
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.