Announcement

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

    Export PDF

    Hi,

    I am working on exporting at client side,
    - SmartGWT's version--> smartgwtee-5.0p
    I have downloaded GWT 5.0 (Latest patched version: Full-featured evaluation: 60 day free trial includes Smart GWT Java Server framework, Visual Builder, and all other non-preview features.) from the link:
    https://www.smartclient.com/product/download.jsp
    - Browser: Google Chrome (Version 41.0.2272.89 m)


    Issue: table with large no. of columns is being clipped always in exported pdf file. Is there any solution for this?
    Could you please provide examples for this.

    #2
    exportClientData() only exports data that has actually been loaded into the browser.

    To export the full dataset regardless of size, use exportData() instead. However, this will not include client-side formatting logic or fields that only exist on the client (and in the server-side DataSource).

    You may be able to replace some of your client-side formatting logic with DataSourceField.format/exportFormat, which will apply to exportData() as well.

    If not, and you are stuck with using exportClientData(), you can adjust ListGrid.dataPageSize so that more data is loaded into the browser (and thus will be exported), or you can cause additional data to be loaded right before export, by calling grid.getResultSet().getRange(0, maxRow) where "maxRow" would be the maximum amount of data you want exported.

    Comment


      #3
      Thanks for the quick reply.

      But here the problem is not with big data or large no. of row. If there is a big no. of rows then it handles the case by showing a vertical scrollbar in the pdf file exported.
      The problem is with a big no. of columns actually. the screen shows horizontal scrollbar in the screen to show all columns fine. But in pdf file exported of the same screen shows no horizontal scrollbar & that'swhy the table is cut at right side of the file.

      Code written for this is as following:
      DSRequest requestProperties = new DSRequest();
      requestProperties.setExportFilename("exportPDF");
      requestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
      requestProperties.setContentType("application/pdf");
      RPCManager.exportContent(layout.getChildren(), requestProperties); // the layout is the object of PortalLayout which is basically the screen in-front to export


      I found a solution for this as following:
      setExportCSS(String exportCSS) as setExportCSS("@page {size: A4 landscape; }").
      But if the no. of columns is even bigger to fit in landscape then this trick also fails.


      Could you please help out ?


      Thanks
      Pinki

      Comment


        #4
        We don't have any way to magically make more data fit on the page. If you still have too many columns, consider reducing font sizes or padding via additional, print-specific CSS.

        Also consider whether printing so many columns is actually what your end users would want. You may want to split the information up somehow instead.

        Comment

        Working...
        X