Announcement

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

    PDFExport

    Hello,

    I just downloaded the SmartGWT 3.0 EE Evaluation, but I am not able to do the pdf export.

    I don't find the examples you mentioned in the forum, and there is no javadocs/examples for isomorphic_contentexport.jar, neither in the "javadocs" nor in the "server javadocs" directories. Where can I find an example?
    I just want to export the contents of a grid.

    Thanks

    #2
    Download a 3.x nightly. There isn't an example in the Showcase, there's just the JavaDoc. The only client-side method you need to call to export to .pdf is RPCManager.exportContent(). The server-side JavaDoc has sample code for the specific use case of saving the generated .pdf to a file.

    Comment


      #3
      When I try do download a nightly build, I get the message:
      Your account does not have access to licenses for SmartGWT 3.0 Pro.

      This is of course the case because I am using the evaluation.

      Comment


        #4
        We're unable to reproduce this download error with the SmartGWT 3.0.x Eval. At what URL are you seeing this error? Do you encounter it with this link?

        Comment


          #5
          Are you sure the javadocs for the PdfExporter are included?

          When I open the javadoc (for the server) on the nightly build you sent me, I see this packages:

          com.isomorphic.base
          com.isomorphic.criteria
          com.isomorphic.criteria.criterion
          com.isomorphic.datasource
          com.isomorphic.hibernate
          com.isomorphic.jpa
          com.isomorphic.js
          com.isomorphic.mail
          com.isomorphic.messaging
          com.isomorphic.rpc
          com.isomorphic.servlet
          com.isomorphic.sql
          com.isomorphic.tools
          com.isomorphic.util
          com.isomorphic.velocity
          com.isomorphic.xml

          But I am looking for com.isomorphic.contentexport, where I can find the PdfExport class.

          Where exactly is the example you mention? I cannot find it.

          Comment


            #6
            Did you forget to put the javadocs for this packet or am I just looking at the wrong location ?

            Comment


              #7
              Sorry, we gave you a bad link. You want a 3.x nightly, from here.

              Comment


                #8
                OK, thank you, I found the docs on the new link.

                I still have a question, how to export the contents of a ListGrid to a PDF. In the javadocs I see an example of exporting html, .,. but how to export a ListGrid?

                To export a ListGrid to Excel, I only had to do this:
                Code:
                DSRequest*dsRequestProperties*=*new*DSRequest();**
                dsRequestProperties.setExportAs((ExportFormat)EnumUtil.getEnum(ExportFormat.values(),*"xls"));**
                dsRequestProperties.setExportDisplay(showInWindow*?*ExportDisplay.WINDOW*:*ExportDisplay.DOWNLOAD);**
                **
                countryList.exportData(dsRequestProperties);*
                Is there any such method for directly exporting the ListGrid contents to PDF ?

                Comment


                  #9
                  The example code is taking the printable HTML of the ListGrid, which is what you want. Just actually try the code.

                  Comment


                    #10
                    Well I try, but still have some problems/questions:

                    The method is:
                    Code:
                    getPdfObject(java.lang.String html,
                                             java.util.Map settings,
                                             javax.servlet.http.HttpServletResponse response,
                                             RPCManager rpc)
                    so I try this:
                    Code:
                    Object[] objs = new Object[]{ listGrid};
                    Canvas.getPrintHTML(objs, null, new PrintHTMLCallback() {
                    String listGridHtml = "";
                    	@Override
                    public void setHTML(String html) {
                    	listGridHtml = html;
                    	PdfExport pdfExport = new PdfExport();
                    //how to get the RPC Manager?
                    	RPCManager rpc = new RPCManager();
                    //how to get the response?
                    	HttpServletResponse response = null;
                    	Map properties = new HashMap();
                    	pdfExport.getPdfObject(html, properties, response, rpc);
                    };
                    My problem is the HttpServletResponse response: we are in the client, trying to get a pdf from a list, why do we have to pass the response from the client? where do I get the response?
                    Same question for the RPCManager rpc. I am not sure how to do this and I am stuck here.

                    Thank you!

                    Comment


                      #11
                      Can someone please help me ?

                      Comment


                        #12
                        We dont understand your confusion. Follow the sample code - it is not the same as yours, and shows sending the file to the httpSerlvetResponse *on the server* which is the only place this could possibly happen.

                        Comment

                        Working...
                        X