Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Save screen to image file

    The version I am using is : SmartClient Version: v10.1p_2016-08-05/PowerEdition Deployment (built 2016-08-05)

    I was trying to export the screen mixed with charts and listgrids to PDF file and it was successful.
    However the layouts were broken like the following.

    Click image for larger version

Name:	pdf_export.png
Views:	188
Size:	32.8 KB
ID:	263885
    I used the following codes to do this.

    DSRequest requestProperties = new DSRequest();
    requestProperties.setExportFilename( "Download" );
    requestProperties.setExportDisplay( ExportDisplay.DOWNLOAD );
    requestProperties.setContentType( "application/pdf" );
    requestProperties.setDownloadResult( true );
    requestProperties.setExportCSS( "@page {size: A3 landscape; max-height:100%; max-width:100%;}" );
    RPCManager.exportContent( detailSubPaneContainerSub, requestProperties );

    What I want is to save the layout to PDF as it is shown in the screen something like screen capture.

    If this cannot be done by exporting to PDF, is there another option like exporting to image(jpg, gif ...)?

    #2
    See the Printing overview - printing shows simplified output that works well on a page. That's why your headers aren't red, for example (think how that would look on a B&W page).

    Layouts are also simplified so that they flow well regardless of page size. We can't comment on why things have moved around without knowing how you used layouts here.

    If you're looking for something more like a screen capture, you may not want the printed output.

    One approach would be to tell the user to simply print and choose printing to PDF - does that work for you?

    There are also low-level approaches to capture the entire page as an image, which could then be "bounced" off the server to enable a download. But this excludes some older browsers.

    Finally, you need to get the latest patched version (you are more than 4 years out of date), and if you are doing new development, you need to be using a recent release (your release is 5 years old).


    Comment


      #3
      I think 'Capturing the entire page as an image' can be one solution.

      The requirement is putting a button or menu for it in the application UI not using the menus in the browser.
      So clicking the button or menu need to save the screen as an image.

      Could you explain to me the details how to implement the comment you mentioned 'There are also low-level approaches to capture the entire page as an image, which could then be "bounced" off the server to enable a download. '?

      Comment


        #4
        You can take whatever you want and put it in a PrintWindow and you then have a button that prints the contents. But again here the end user would have to choose to print to PDF, rather than just have a button that immediately begins such a download. Would that still work?

        Capturing the screen as an image is going to require low-level JavaScript techniques, won't work on some browsers. Here is on outline of the necessary approach. We could add this for you via Feature Sponsorship, then provide support for your older version with a patch file - let us know if that's interesting.

        The first thing to do however, as previously mentioned, is to get up to date on patches and/or try a more recent version.

        Comment


          #5
          Thank you so much for your quick advice.

          I will take a look at what you recommended in more detail and contact you again if I need more consult from you.

          Comment


            #6
            When I tried print preview, it looked much better than PDF export like the following.
            I don't understand why PDF export and Print preview result are different that much.
            Did I miss any configuration for PDF export in my above codes to get the better result like print preview?

            Click image for larger version  Name:	print.png Views:	0 Size:	29.3 KB ID:	263904

            Comment


              #7
              Exporting to PDF takes the print preview’s HTML and renders it on the server side using the iText library (see Java Module Dependencies).

              iText can look different from the browser’s rendering based on bugs and/or lack of features in iText.

              You are still 4 years behind on patches on a 5 year old version, and you’ve given us zero information about the layouts in use, so that’s all we can say for now.

              Comment

              Working...
              X