2 Replies Latest reply: Jan 14, 2011 6:42 AM by Graham Mckendry-Oracle RSS

    How to print/ convert the drawing into pdf with only single/ desired page

    user141862
      We are using the vueBean API to convert the engineering drawing with extension .dwg/.dgn. The convert method of vuebean class is able to converting into pdf document. But the resultant pdf document is getting all the pages that are consisting in the drawing file.

      We require the resultant pdf file with only first page rather than all pages from the source drawing file. Below given is the code that we used for conversion.


           VectorConvertOptions opts=new VectorConvertOptions();
      opts.setStepsPerInch(1);
      PAN_CtlFileInfo fi;
      fi= m_vueBean.getFileInfo();
      PAN_CtlRange pspdf;
      pspdf = m_vueBean.getPageSizeEx();

      if (fi.getType() == fi.PAN_DocumentFile) {
           pspdf = fi.getPageSize();
      }

      opts.setInputRange(pspdf);
      opts.setArea(ConvertOptions2D.AREA_EXTENTS);
      opts.setScaleFactor(100);
      opts.setScaleType(ConvertOptions2D.TYPE_SCALE);
      opts.setWidth(Math.abs(pspdf.width()));
      opts.setHeight(Math.abs(pspdf.height()));
      opts.setPages(ConvertOptions2D.PAGES_CURRENT);
      opts.setFromPage(1);
      opts.setToPage(1);
      opts.setFormat("PCVC_PDF");
      opts.setSubFormatID(0);
      opts.setFileName(f_dest_fname);

      // Uploads the markups
      Property[] ppdf = m_vueBean.uploadMarkups();
      opts.setProperties(ppdf);
      m_vueBean.convert(opts);
        • 1. Re: How to print/ convert the drawing into pdf with only single/ desired page
          Ricardo Av-Oracle
          Conversion code does not support converting bits and pieces of a files (it convert the entire file)
          You can use the printing code from the jvue.html to print a page of a file but when printing to a file it might be difficult to see where the output file is (driver dependent or you may get a dialog) and those lssues will need to be dealt with outside JVue.
          • 2. Re: How to print/ convert the drawing into pdf with only single/ desired page
            Graham Mckendry-Oracle
            To clarify, their is no printing code in "jvue.html". The file "jvue.html" is a sample frameset showing a sample webpage containing the JVue applet. However, the same "html" folder in the AutoVue Client/Server Deployment installation does contain a sample printing webpage called "batchPrint.html", which is what the previous response was referring to. The printing code in that sample is through Javascript, but could easily be modified to implement directly in Java. Here's an excerpt from batchPrint.html:

            var myApp = window.document.applets["JVue"];
            var pPropsClass = myApp.getClass("com.cimmetry.common.PrintProperties");
            var pProps = pPropsClass.newInstance();
            pProps.setProfile(myApp.getActiveVueBean().getProfile());
            pProps.getHeaders().setTopCenterText("My header is here");
            pProps.getHeaders().setBottomLeftText("%f");
            pProps.getHeaders().setBottomRightText("%p of %n");
            pProps.getOptions().setArea(0);
            pProps.getOptions().setPages(0);
            pProps.getOptions().setHighResolution(false);


            The sample then calls JVue.batchPrint, but you would likely want to use JVue.printFile. For more information see the Javadocs for the com.cimmetry.jvue.JVue.printFile method, as well as the com.cimmetry.common.PrintOptions class and com.cimmetry.common.PrintProperties class. The methods com.cimmetry.common.PrintOptions.setFromPage and com.cimmetry.common.PrintOptions.setToPage might be what you need.

            Also for cleanliness, can use the static constant to indicate to print a range: com.cimmetry.common.PrintOptions.setPages(com.cimmetry.common.PrintOptions.PAGES_RANGE)