Examples of PdfPageData


Examples of org.jpedal.objects.PdfPageData

          int userChoice=current_selection.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerRotation.text"));

          //get parameters and call if YES
          if (userChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.rotate(commonValues.getPageCount(),currentPageData,current_selection);
            open(commonValues.getSelectedFile());
          }

        }
      }else{

      }
      break;

    case SETCROP:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
          //get values from user
          CropPDFPages cropPage = new CropPDFPages(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int cropPageChoice=cropPage.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerTooltip.PDFCropPages"));

          //get parameters and call if YES
          if (cropPageChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.setCrop(commonValues.getPageCount(),currentPageData,cropPage);
            open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

    case NUP:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
//          get values from user
          ExtractPDFPagesNup nup = new ExtractPDFPagesNup(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int nupChoice=nup.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerNUP.titlebar"));

          //get parameters and call if YES
          if (nupChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            //decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.nup(commonValues.getPageCount(),currentPageData,nup);
            //open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

    case HANDOUTS:
      if(args==null){
        if(fileIsURL)
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewerMessage.CannotExportFromURL"));

        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
          if(!fileIsURL){//ensure file choose not displayed if opened from URL
            JFileChooser chooser1 = new JFileChooser();
            chooser1.setFileSelectionMode(JFileChooser.FILES_ONLY);

            int approved1=chooser1.showSaveDialog(null);
            if(approved1==JFileChooser.APPROVE_OPTION){

              File file = chooser1.getSelectedFile();

              ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
              itextFunctions.handouts(file.getAbsolutePath());
            }
          }
        }
      }else{

      }
      break;

    case SIGN:
      if(args==null) {
        if(fileIsURL) {
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewerMessage.CannotExportFromURL"));
        }
        else if (commonValues.getSelectedFile()==null) {
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }
        else if(!decode_pdf.isExtractionAllowed())
        {
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewerMessage.ExtractionNotAllowed"));
        }
        else {
          SignData signData=new SignData();
          SignWizardModel signer = new SignWizardModel(signData, commonValues.getSelectedFile(), commonValues.getInputDir());
          Wizard signWizard = new Wizard((Frame) currentGUI.getFrame(), signer);

          if(signWizard.showModalDialog()!= JOptionPane.OK_OPTION) break;

          if(!signData.validate()) {
            currentGUI.showMessageDialog(signData.toString());
            break;
          }

          int response = JOptionPane.showConfirmDialog(currentGUI.getFrame(),
              signData.toString(),
              Messages.getMessage("PdfViewerGeneral.IsThisCorrect"),
              JOptionPane.OK_CANCEL_OPTION,
              JOptionPane.QUESTION_MESSAGE);

          if(response==JOptionPane.OK_OPTION) {
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.Sign(signData);
          }
          else {
            JOptionPane.showMessageDialog(currentGUI.getFrame(),
                Messages.getMessage("PdfViewerMessage.SigningOperationCancelled"),
                Messages.getMessage("PdfViewerGeneral.Warning"),
                JOptionPane.WARNING_MESSAGE);
          }
        }
      }
      break;

    case DELETE:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
          //get values from user
          DeletePDFPages deletedPages = new DeletePDFPages(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int deletedPagesChoice=deletedPages.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerDelete.text"));

          //get parameters and call if YES
          if (deletedPagesChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.delete(commonValues.getPageCount(),currentPageData,deletedPages);
            open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

        case ADDHEADERFOOTER:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{

          //get values from user
          AddHeaderFooterToPDFPages addHeaderFooter = new AddHeaderFooterToPDFPages(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int headerFooterPagesChoice=addHeaderFooter.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerTitle.AddHeaderAndFooters"));

          //get parameters and call if YES
          if (headerFooterPagesChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.addHeaderFooter(commonValues.getPageCount(),currentPageData,addHeaderFooter);
            open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

    case STAMPTEXT:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
          //get values from user
          StampTextToPDFPages stampText = new StampTextToPDFPages(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int stampTextChoice=stampText.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerStampText.text"));

          //get parameters and call if YES
          if (stampTextChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.stampText(commonValues.getPageCount(),currentPageData,stampText);
            open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

    case STAMPIMAGE:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{

          //get values from user
          StampImageToPDFPages stampImage = new StampImageToPDFPages(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int stampImageChoice=stampImage.display(currentGUI.getFrame(),Messages.getMessage("PdfViewerStampImage.text"));

          //get parameters and call if YES
          if (stampImageChoice == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.stampImage(commonValues.getPageCount(),currentPageData,stampImage);
            open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

    case ADD:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
          //get values from user
          InsertBlankPDFPage addPage = new InsertBlankPDFPage(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int positionToAdd=addPage.display(currentGUI.getFrame(),Messages.getMessage("PdfViewer.BlankPage"));

          //get parameters and call if YES
          if (positionToAdd == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.add(commonValues.getPageCount(),currentPageData,addPage);
            open(commonValues.getSelectedFile());
          }
        }
      }else{

      }
      break;

    case SECURITY:
      if(args==null){
        if(commonValues.getSelectedFile()==null){
          currentGUI.showMessageDialog(Messages.getMessage("PdfViewer.NoFile"));
        }else{
          //get values from user
          EncryptPDFDocument encryptPage = new EncryptPDFDocument(commonValues.getInputDir(), commonValues.getPageCount(), commonValues.getCurrentPage());
          int encrypt=encryptPage.display(currentGUI.getFrame(),"Standard Security");

          //get parameters and call if YES
          if (encrypt == JOptionPane.OK_OPTION){

            PdfPageData currentPageData=decode_pdf.getPdfPageData();

            decode_pdf.closePdfFile();
            ItextFunctions itextFunctions=new ItextFunctions(currentGUI,commonValues.getSelectedFile(),decode_pdf);
            itextFunctions.encrypt(commonValues.getPageCount(),currentPageData,encryptPage);
            open(commonValues.getSelectedFile());
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

    String extractedText = "";
    //always reset to use unaltered co-ords
    PdfGroupingAlgorithms.useUnrotatedCoords=true;

    //page data so we can choose portrait or landscape
    PdfPageData pageData=decode_pdf.getPdfPageData();
    int rotation=pageData.getRotation(commonValues.getCurrentPage());
    if(rotation!=0){
      int alterCoords=currentGUI.showConfirmDialog(Messages.getMessage("PdfViewerRotatedCoords.message"),
          Messages.getMessage("PdfViewerOutputFormat.message"),
          JOptionPane.YES_NO_OPTION);
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

          currentGUI.updateStatusMessage(Messages.getMessage("PdfViewerDecoding.page"));

          if (img != null)
            addImage(img);

          PdfPageData page_data = decode_pdf.getPdfPageData();
         
          if (img != null)
            page_data.setMediaBox(new float[]{0,0,img.getWidth(),img.getHeight()});

          page_data.checkSizeSet(1);
          currentGUI.resetRotationBox();

          /**
           * make sure screen fits display nicely
           */
 
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

        int displayView=decode_pdf.getDisplayView();
        if(page<1 || page>decode_pdf.getPageCount() || displayView==Display.SINGLE_PAGE){
            page=decode_pdf.pageNumber;
        }

        PdfPageData pageData=decode_pdf.getPdfPageData();
        int cropW = pageData.getCropBoxWidth(page);
        int cropH = pageData.getCropBoxHeight(page);
        int cropX = pageData.getCropBoxX(page);
        int cropY = pageData.getCropBoxY(page);

        switch (decode_pdf.displayRotation) {
            case 0:
                x = (int) ((highlight.x - cropX) * scaling) + insetW;
                y = (int) ((cropH - (highlight.y - cropY)) * scaling) + insetH;
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

        //set page number display
        pageCounter2.setText(String.valueOf(currentPage));
        pageCounter3.setText("of " + pdfDecoder.getPageCount());

        PdfPageData pageData = pdfDecoder.getPdfPageData();

        int width = pageData.getCropBoxWidth(1);
        int height = pageData.getCropBoxHeight(1) + 45; // topbar offset

        Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
       
        width = Math.min(width, screen.width/2);
        height = Math.min(height, screen.height/2);

        pack();
       
        setSize(width, height);
      

        getContentPane().addHierarchyBoundsListener(new HierarchyBoundsListener() {

            @Override
            public void ancestorMoved(HierarchyEvent e) {
                //
            }

            @Override
            public void ancestorResized(HierarchyEvent e) {

                PdfPageData pageData = pdfDecoder.getPdfPageData();

                float widthScale = pdfDecoder.getVisibleRect().width / (float) pageData.getCropBoxWidth(currentPage);
                float heightScale = pdfDecoder.getVisibleRect().height / (float) pageData.getCropBoxHeight(currentPage);

                float scale = Math.min(widthScale, heightScale);


                if (scaleToWidth) {
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

         
          /** create a grouping object to apply grouping to data*/
          PdfGroupingAlgorithms currentGrouping =decode_pdf.getGroupingObject();
         
          /**use whole page size for  demo - get data from PageData object*/
          PdfPageData currentPageData = decode_pdf.getPdfPageData();
         
          int x1,y1,x2,y2;
         
          x1 = currentPageData.getMediaBoxX(page);
          x2 = currentPageData.getMediaBoxWidth(page)+x1;
         
          y2 = currentPageData.getMediaBoxY(page);
          y1 = currentPageData.getMediaBoxHeight(page)+y2;
         
          //default for xml
          String ending="_text.csv";
         
          if(useXMLExtraction)
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

         
          /** create a grouping object to apply grouping to data*/
          PdfGroupingAlgorithms currentGrouping =decode_pdf.getGroupingObject();
         
          /**use whole page size for  demo - get data from PageData object*/
          PdfPageData currentPageData = decode_pdf.getPdfPageData();
         
          int x1 = currentPageData.getMediaBoxX(page);
          int x2 = currentPageData.getMediaBoxWidth(page)+x1;
         
          int y2 = currentPageData.getMediaBoxX(page);
          int y1 = currentPageData.getMediaBoxHeight(page)-y2;
         
          /**Co-ordinates are x1,y1 (top left hand corner), x2,y2(bottom right) */
         
          /**The call to extract the list*/
          List words =null;
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

         
          /** create a grouping object to apply grouping to data*/
          PdfGroupingAlgorithms currentGrouping =decode_pdf.getGroupingObject();
         
          /**use whole page size for  demo - get data from PageData object*/
          PdfPageData currentPageData = decode_pdf.getPdfPageData();
         
          int x1 = currentPageData.getMediaBoxX(page);
          int x2 = currentPageData.getMediaBoxWidth(page)+x1;
         
          int y2 = currentPageData.getMediaBoxY(page);
          int y1 = currentPageData.getMediaBoxHeight(page)+y2;
         
          /**Co-ordinates are x1,y1 (top left hand corner), x2,y2(bottom right) */
         
          /**The call to extract the text*/
          String text =null;
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

    /* (non-Javadoc)
     * @see org.jpedal.examples.simpleviewer.gui.swing.GUIFactory#resetRotationBox()
     */
    public void resetRotationBox() {

        PdfPageData currentPageData = decode_pdf.getPdfPageData();

        //>>> DON'T UNCOMMENT THIS LINE, causes major rotation issues, only useful for debuging <<<
        if (decode_pdf.getDisplayView() == Display.SINGLE_PAGE) {
            rotation = currentPageData.getRotation(commonValues.getCurrentPage());
        }
        //else
        //rotation=0;

        if (getSelectedComboIndex(Commands.ROTATION) != (rotation / 90)) {
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

      details.add(Box.createVerticalStrut(10));

      /**
       * get the Pdf file information object to extract info from
       */
      PdfPageData currentPageSize=decode_pdf.getPdfPageData();

      if(currentPageSize!=null){

        //general details
        JLabel header3=new JLabel(Messages.getMessage("PdfViewerCoords.text"));
        header3.setFont(headFont);
        details.add(header3);

        JLabel g7=new JLabel(Messages.getMessage("PdfViewermediaBox.text")+currentPageSize.getMediaValue(currentPage));
        g7.setFont(textFont);
        details.add(g7);

        JLabel g8=new JLabel(Messages.getMessage("PdfViewercropBox.text")+currentPageSize.getCropValue(currentPage));
        g8.setFont(textFont);
        details.add(g8);

        JLabel g9=new JLabel(Messages.getMessage("PdfViewerLabel.Rotation")+currentPageSize.getRotation(currentPage));
        g9.setFont(textFont);
        details.add(g9);

      }

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.