Examples of PdfPageData


Examples of org.jpedal.objects.PdfPageData

      if(isMultiPageTiff)
        page = 1;
           
      //always check in facing mode with turnover on
            if (index != -1 || decode_pdf.getDisplayView() == Display.SINGLE_PAGE  || (decode_pdf.getDisplayView() == Display.FACING && currentCommands.getPages().getTurnoverOn())) {
                PdfPageData pageData = decode_pdf.getPdfPageData();
                int cw,ch,raw_rotation=0;

                if (decode_pdf.getDisplayView()==Display.FACING)
                    raw_rotation=pageData.getRotation(page);

                boolean isRotated = (rotation+raw_rotation)%180==90;

                PageOffsets offsets = (PageOffsets)decode_pdf.getExternalHandler(Options.CurrentOffset);
                switch(decode_pdf.getDisplayView()) {
                    case Display.CONTINUOUS_FACING:
                        if (isRotated) {
                            cw = offsets.getMaxH()*2;
                            ch = offsets.getMaxW();
                        }else{
                            cw = offsets.getMaxW()*2;
                            ch = offsets.getMaxH();
                        }
                        break;
                    case Display.CONTINUOUS:
                        if (isRotated) {
                            cw = offsets.getMaxH();
                            ch = offsets.getMaxW();
                        }else{
                            cw = offsets.getMaxW();
                            ch = offsets.getMaxH();
                        }
                        break;
                    case Display.FACING:
                        int leftPage;

                        if(currentCommands.getPages().getSeparateCover()) {
                            leftPage = (page/2)*2;
                            if (commonValues.getPageCount() == 2)
                                leftPage = 1;
                        } else {
                            leftPage = (page);
                            if ((leftPage & 1) == 0)
                                leftPage--;
                        }

                        if (isRotated) {
                            cw = pageData.getCropBoxHeight(leftPage);

                            //if first or last page double the width, otherwise add other page width
                            if (leftPage+1 > commonValues.getPageCount() || leftPage == 1)
                                cw = cw * 2;
                            else
                                cw += pageData.getCropBoxHeight(leftPage+1);

                            ch = pageData.getCropBoxWidth(leftPage);
                            if (leftPage+1 <= commonValues.getPageCount() && ch < pageData.getCropBoxWidth(leftPage+1))
                                ch = pageData.getCropBoxWidth(leftPage+1);
                        }else{
                            cw = pageData.getCropBoxWidth(leftPage);

                            //if first or last page double the width, otherwise add other page width
                            if (leftPage+1 > commonValues.getPageCount())
                                cw = cw * 2;
                            else
                                cw += pageData.getCropBoxWidth(leftPage+1);

                            ch = pageData.getCropBoxHeight(leftPage);
                            if (leftPage+1 <= commonValues.getPageCount() && ch < pageData.getCropBoxHeight(leftPage+1))
                                ch = pageData.getCropBoxHeight(leftPage+1);
                        }
                        break;
                    default:
                        if (isRotated) {
                            cw = pageData.getCropBoxHeight(page);
                            ch = pageData.getCropBoxWidth(page);
                        }else{
                            cw = pageData.getCropBoxWidth(page);
                            ch = pageData.getCropBoxHeight(page);
                        }
                }

                //Add space at the bottom for pageFlow
                if (decode_pdf.getDisplayView()==Display.PAGEFLOW)
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

        }else{
            width=desktopPane.getWidth();
            height=desktopPane.getHeight();
        }

        PdfPageData pageData = decode_pdf.getPdfPageData();
        int cw,ch,raw_rotation=0;

        if (decode_pdf.getDisplayView()==Display.FACING)
            raw_rotation=pageData.getRotation(commonValues.getCurrentPage());

        boolean isRotated = (rotation+raw_rotation)%180==90;

        PageOffsets offsets = (PageOffsets)decode_pdf.getExternalHandler(Options.CurrentOffset);
        switch(decode_pdf.getDisplayView()) {
            case Display.CONTINUOUS_FACING:
                if (isRotated) {
                    cw = offsets.getMaxH()*2;
                    ch = offsets.getMaxW();
                }else{
                    cw = offsets.getMaxW()*2;
                    ch = offsets.getMaxH();
                }
                break;
            case Display.CONTINUOUS:
                if (isRotated) {
                    cw = offsets.getMaxH();
                    ch = offsets.getMaxW();
                }else{
                    cw = offsets.getMaxW();
                    ch = offsets.getMaxH();
                }
                break;
            case Display.FACING:
                int leftPage;
                if (currentCommands.getPages().getSeparateCover()) {
                    leftPage = (commonValues.getCurrentPage()/2)*2;
                    if (commonValues.getPageCount() == 2)
                        leftPage = 1;
                } else {
                    leftPage = commonValues.getCurrentPage();
                    if ((leftPage & 1)==0)
                        leftPage--;
                }

                if (isRotated) {
                    cw = pageData.getCropBoxHeight(leftPage);

                    //if first or last page double the width, otherwise add other page width
                    if (leftPage+1 > commonValues.getPageCount() || leftPage == 1)
                        cw = cw * 2;
                    else
                        cw += pageData.getCropBoxHeight(leftPage+1);

                    ch = pageData.getCropBoxWidth(leftPage);
                    if (leftPage+1 <= commonValues.getPageCount() && ch < pageData.getCropBoxWidth(leftPage+1))
                        ch = pageData.getCropBoxWidth(leftPage+1);
                }else{
                    cw = pageData.getCropBoxWidth(leftPage);

                    //if first or last page double the width, otherwise add other page width
                    if (leftPage+1 > commonValues.getPageCount())
                        cw = cw * 2;
                    else
                        cw += pageData.getCropBoxWidth(leftPage+1);

                    ch = pageData.getCropBoxHeight(leftPage);
                    if (leftPage+1 <= commonValues.getPageCount() && ch < pageData.getCropBoxHeight(leftPage+1))
                        ch = pageData.getCropBoxHeight(leftPage+1);
                }
                break;
            default:
                if (isRotated) {
                    cw = pageData.getCropBoxHeight(commonValues.getCurrentPage());
                    ch = pageData.getCropBoxWidth(commonValues.getCurrentPage());
                }else{
                    cw = pageData.getCropBoxWidth(commonValues.getCurrentPage());
                    ch = pageData.getCropBoxHeight(commonValues.getCurrentPage());
                }
        }

        //Add space at the bottom for pageFlow
        if (decode_pdf.getDisplayView()==Display.PAGEFLOW)
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

          xCord = 0;
        }
      }
      //System.out.println("Before="+decode_pdf.getVisibleRect()+" "+decode_pdf.getPreferredSize());

      PdfPageData pageData = decode_pdf.getPdfPageData();

      int ch = (int)(pageData.getCropBoxHeight(commonValues.getCurrentPage())*scaling);
      int cw = (int)(pageData.getCropBoxWidth(commonValues.getCurrentPage())*scaling);

      int centerH = xCord + ((cw-scrollPane.getHorizontalScrollBar().getVisibleAmount())/2);
      int centerV = yCord + (ch-scrollPane.getVerticalScrollBar().getVisibleAmount())/2;

            //PAGEFLOW works differently
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

              "See http://www.jpedal.org/support_FontSub.php");

              showMessageDialog(status);
            }
            //read values for page display
            PdfPageData page_data = decode_pdf.getPdfPageData();

            mediaW  = page_data.getMediaBoxWidth(commonValues.getCurrentPage());
            mediaH = page_data.getMediaBoxHeight(commonValues.getCurrentPage());
            mediaX = page_data.getMediaBoxX(commonValues.getCurrentPage());
            mediaY = page_data.getMediaBoxY(commonValues.getCurrentPage());

            cropX = page_data.getCropBoxX(commonValues.getCurrentPage());
            cropY = page_data.getCropBoxY(commonValues.getCurrentPage());
            cropW = page_data.getCropBoxWidth(commonValues.getCurrentPage());
            cropH = page_data.getCropBoxHeight(commonValues.getCurrentPage());

//            resetRotationBox();


            //create custom annot icons
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

     * @param pdfDecoder    The <tt>PdfDecoder</tt> encapsulating the PdfPage
     * @return  The nearest available <tt>PageFormat</tt> for this <tt>PrintService</tt>
     */
    public static PageFormat getPageFormat(int p, PdfDecoder pdfDecoder)
    {
        PdfPageData pageData = pdfDecoder.getPdfPageData();
      
        float cropW = pageData.getCropBoxWidth(p);
        float cropH = pageData.getCropBoxHeight(p);
              
        PageFormat result = PdfPageFormat.getAppropriatePageFormat(cropW, cropH);
       
        return result;
    }
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

      int pageCount= decode_pdf.getPageCount();
      System.out.println( "Page count=" + pageCount );


            //get PageData object
            PdfPageData pageData = decode_pdf.getPdfPageData();
            //show all page sizes
            for(int ii=0;ii<pageCount;ii++){

                //pixels
                System.out.print("page (size in pixels) "+ii+
                        " mediaBox="+pageData.getMediaBoxX(ii)+ ' ' +pageData.getMediaBoxY(ii)+ ' ' +pageData.getMediaBoxWidth(ii)+ ' ' +pageData.getMediaBoxHeight(ii)+
                        " CropBox="+pageData.getCropBoxX(ii)+ ' ' +pageData.getCropBoxY(ii)+ ' ' +pageData.getCropBoxWidth(ii)+ ' ' +pageData.getCropBoxHeight(ii));

                //inches
                float factor=72f; //72 is the usual screen dpi
                System.out.print(" (size in inches) "+ii+
                        " mediaBox="+pageData.getMediaBoxX(ii)/factor+ ' ' +pageData.getMediaBoxY(ii)/factor+ ' ' +pageData.getMediaBoxWidth(ii)/factor+ ' ' +pageData.getMediaBoxHeight(ii)/factor+
                        " CropBox="+pageData.getCropBoxX(ii)/factor+ ' ' +pageData.getCropBoxY(ii)/factor+pageData.getCropBoxWidth(ii)/factor+ ' ' +pageData.getCropBoxHeight(ii)/factor);

                //cm
                factor=72f/2.54f;
                System.out.print(" (size in cm) "+ii+
                        " mediaBox="+pageData.getMediaBoxX(ii)/factor+ ' ' +pageData.getMediaBoxY(ii)/factor+ ' ' +pageData.getMediaBoxWidth(ii)/factor+ ' ' +pageData.getMediaBoxHeight(ii)/factor+
                        " CropBox="+pageData.getCropBoxX(ii)/factor+ ' ' +pageData.getCropBoxY(ii)/factor+pageData.getCropBoxWidth(ii)/factor+ ' ' +pageData.getCropBoxHeight(ii)/factor+ '\n');

            }

      /**close the pdf file*/
      decode_pdf.closePdfFile();
 
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

        }
    }

    final public void updateCursorBoxOnScreen(Rectangle newOutlineRectangle, Color outlineColor, PdfDecoder pdfDecoder, int pageNumber) {

        PdfPageData pageData=pdfDecoder.getPdfPageData();

        //area to reapint
        int x_size=pdfDecoder.x_size;
        int y_size=pdfDecoder.y_size;

        if(newOutlineRectangle!=null){

            int x=newOutlineRectangle.x;
            int y=newOutlineRectangle.y;
            int w=newOutlineRectangle.width;
            int h=newOutlineRectangle.height;

            int cropX=pageData.getCropBoxX(pageNumber);
            int cropY=pageData.getCropBoxY(pageNumber);
            int cropW=pageData.getCropBoxWidth(pageNumber);
            int cropH=pageData.getCropBoxHeight(pageNumber);

            //allow for odd crops and correct
            if(y>0 && y<(cropY))
                y=y+cropY;
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

          decode_pdf.getTextLines().clearHighlights();

          //System.out.println("textToFind = "+textToFind);

          // get page sizes
          PdfPageData pageSize = decode_pdf.getPdfPageData();

          int x1, y1, x2, y2;

          // page range
          //int startPage = 1;
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

                int x1 = (int) ((signRectOrigin.getX() - offsetX) / scale);
                int y1 = (int) ( height - ((signRectOrigin.getY() - offsetY) / scale));
        int x2 = (int) ((signRectEnd.getX() - offsetX) / scale);
        int y2 = (int) (height - ((signRectEnd.getY() - offsetY) / scale));
       
        PdfPageData pageData = pdfDecoder.getPdfPageData();
        int cropX = pageData.getCropBoxX(currentPage);
        int cropY = pageData.getCropBoxY(currentPage);
        x1 += cropX;
        y1 += cropY;
        x2 += cropX;
        y2 += cropY;
       
View Full Code Here

Examples of org.jpedal.objects.PdfPageData

    }
   
    private void drawSignBox(Graphics g)
    {
      if(signAreaUndefined) {
        PdfPageData pageData = pdfDecoder.getPdfPageData();
        signRectOrigin = new Point(offsetX,offsetY);
        signRectEnd = new Point((int) (pageData.getCropBoxWidth(currentPage) * scale) - 1 + offsetX,
                            (int) (pageData.getCropBoxHeight(currentPage) * scale) - 1 + offsetY);
        signAreaUndefined = false;
      }
      int xO = (int) signRectOrigin.getX();
      int yO = (int) signRectOrigin.getY();
      int xE = (int) signRectEnd.getX();  
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.