Announcement

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

    TextItem Values don't display on exported PDF

    I'm exporting to PDF via the RPCManager, and my FloatItem and TextItem values aren't being displayed in the PDF. If I call Canvas.showPrintPreview(), the values are displayed.

    I'm running SNAPSHOT_v8.3d_2012-09-04/Enterprise Deployment (built 2012-09-04) in Firefox 13.0.1 on MacOSX.

    Here is sample code to reproduce the problem.

    Code:
    package com.smartgwt.sample.client;
    
    import java.util.Date;
    
    import com.google.gwt.core.client.EntryPoint;
    import com.smartgwt.client.data.DSRequest;
    import com.smartgwt.client.rpc.RPCManager;
    import com.smartgwt.client.types.ExportDisplay;
    import com.smartgwt.client.widgets.Canvas;
    import com.smartgwt.client.widgets.IButton;
    import com.smartgwt.client.widgets.events.ClickEvent;
    import com.smartgwt.client.widgets.events.ClickHandler;
    import com.smartgwt.client.widgets.form.DynamicForm;
    import com.smartgwt.client.widgets.form.fields.FloatItem;
    import com.smartgwt.client.widgets.form.fields.TextItem;
    import com.smartgwt.client.widgets.layout.VLayout;
    
    /**
     * Entry point classes define <code>onModuleLoad()</code>.
     */
    public class BuiltInDS implements EntryPoint {
    
    	/**
    	 * This is the entry point method.
    	 */
    	public void onModuleLoad() {
    
    		final VLayout example = new VLayout();
    
    		IButton pdfButton = new IButton("Print to PDF", new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				DSRequest requestProperties = new DSRequest();
    				requestProperties.setExportFilename("formprint"
    						+ (new Date()).getTime() + ".pdf");
    				requestProperties.setExportDisplay(ExportDisplay.DOWNLOAD);
    				requestProperties.setContentType("application/pdf");
    				requestProperties.setDownloadResult(true);
    				RPCManager.exportContent(example, requestProperties);
    			}
    		});
    		example.addMember(pdfButton);
    		IButton printButton = new IButton("Print", new ClickHandler() {
    			@Override
    			public void onClick(ClickEvent event) {
    				 Canvas.showPrintPreview(example);
    			}
    		});
    		example.addMember(printButton);
    
    		DynamicForm form = new DynamicForm();
    
    		FloatItem f1 = new FloatItem("f1", "f1");
    		TextItem t2 = new TextItem("t2", "t2");
    		FloatItem f3 = new FloatItem("f3", "f3");
    
    		form.setFields(f1, t2, f3);
    
    		example.addMember(form);
    
    		example.draw();
    
    	}
    
    }
    If you enter values in the 3 form fields, and then press the Print to PDF button, you'll see the generated PDF shows the fields as empty.

    Any ideas?

    Thanks,
    Chris

    #2
    This was due to a temporary regression and has now been fixed - grab tomorrow's nightly for the fix.

    Comment


      #3
      I have downloaded today's build, and it does indeed fix the problem. However, this build introduced another issue.

      I'm using an extra stylesheet in our app, and it is specified in our server.properties file as:

      skin.Jeppesen.extraStyleSheet: theme/fpo/fpo.css

      This stylesheet is no longer being loaded when I export to PDF. The PDF comes out quite ugly because of the missing styling. It was loading fine in previous builds. Did the API for including an extra style sheet on print change?

      Here is an exception I found in the logs when this occured:

      Code:
           [exec] 17:12:29,123 INFO  [STDOUT] 2012-09-07 11:12:29,123 [http-0.0.0.0-8080-9] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in main path. Error: /Users/christopher.justice/Development/FPO_v01_mac/3rdParty/jboss/server/standard/tmp/vfs/automountedb1d02fff8f68f4/fpo.war-e0adafc5e262ee2e/fpo/sc/skins/Jeppesen/fpo.css (No such file or directory). Searching in alternative path
           [exec] 17:12:29,123 INFO  [STDOUT] 2012-09-07 11:12:29,123 [http-0.0.0.0-8080-9] WARN  com.isomorphic.contentexport.ResourceLoader - Resource not found in alternative path. Error: fpo.css (No such file or directory)
           [exec] 17:12:29,123 ERROR [STDERR] java.io.IOException: Stream closed
           [exec] 17:12:29,124 ERROR [STDERR] 	at java.io.BufferedInputStream.getInIfOpen(BufferedInputStream.java:134)
           [exec] 17:12:29,124 ERROR [STDERR] 	at java.io.BufferedInputStream.read1(BufferedInputStream.java:256)
           [exec] 17:12:29,124 ERROR [STDERR] 	at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
           [exec] 17:12:29,124 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:264)
           [exec] 17:12:29,124 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:306)
           [exec] 17:12:29,124 ERROR [STDERR] 	at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:158)
           [exec] 17:12:29,124 ERROR [STDERR] 	at java.io.InputStreamReader.read(InputStreamReader.java:167)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.css.parser.Lexer.zzRefill(Lexer.java:1634)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.css.parser.Lexer.yylex(Lexer.java:1865)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.css.parser.CSSParser.next(CSSParser.java:1798)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.css.parser.CSSParser.la(CSSParser.java:1810)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.css.parser.CSSParser.stylesheet(CSSParser.java:159)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.css.parser.CSSParser.parseStylesheet(CSSParser.java:89)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:78)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.context.StylesheetFactoryImpl.parse(StylesheetFactoryImpl.java:95)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.context.StylesheetFactoryImpl.getStylesheet(StylesheetFactoryImpl.java:174)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.context.StyleReference.readAndParseAll(StyleReference.java:123)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.context.StyleReference.setDocumentContext(StyleReference.java:107)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:175)
           [exec] 17:12:29,125 ERROR [STDERR] 	at org.xhtmlrenderer.pdf.ITextRenderer.setDocument(ITextRenderer.java:142)
           [exec] 17:12:29,125 ERROR [STDERR] 	at com.isomorphic.contentexport.PdfExport.getPdfRenderer(PdfExport.java:249)
           [exec] 17:12:29,125 ERROR [STDERR] 	at com.isomorphic.contentexport.PdfExport.getPdfObject(PdfExport.java:50)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.rpc.BuiltinRPC.getPdfObject(BuiltinRPC.java:829)
           [exec] 17:12:29,126 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           [exec] 17:12:29,126 ERROR [STDERR] 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           [exec] 17:12:29,126 ERROR [STDERR] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           [exec] 17:12:29,126 ERROR [STDERR] 	at java.lang.reflect.Method.invoke(Method.java:597)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:972)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.base.Reflection.adaptArgsAndInvoke(Reflection.java:804)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:306)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.rpc.RPCDMI.execute(RPCDMI.java:66)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.rpc.RPCRequest.execute(RPCRequest.java:231)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.servlet.IDACall.handleRPCRequest(IDACall.java:285)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.servlet.IDACall.processRPCTransaction(IDACall.java:169)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.servlet.IDACall.processRequest(IDACall.java:138)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.servlet.IDACall.doPost(IDACall.java:74)
           [exec] 17:12:29,126 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
           [exec] 17:12:29,126 ERROR [STDERR] 	at com.isomorphic.servlet.BaseServlet.service(BaseServlet.java:152)
           [exec] 17:12:29,127 ERROR [STDERR] 	at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:181)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.event(CatalinaContext.java:285)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.modcluster.catalina.CatalinaContext$RequestListenerValve.invoke(CatalinaContext.java:261)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:88)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:100)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
           [exec] 17:12:29,127 ERROR [STDERR] 	at org.jboss.web.tomcat.service.request.ActiveRequestResponseCacheValve.invoke(ActiveRequestResponseCacheValve.java:53)
           [exec] 17:12:29,128 ERROR [STDERR] 	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
           [exec] 17:12:29,128 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
           [exec] 17:12:29,128 ERROR [STDERR] 	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:654)
           [exec] 17:12:29,128 ERROR [STDERR] 	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
           [exec] 17:12:29,128 ERROR [STDERR] 	at java.lang.Thread.run(Thread.java:680)
      It appears that it is now looking for my extra stylesheet in the skins directory of my application. This is problematic, as the skin is used by many projects at our company, and the extra style sheet applies to just this application. The behavior that was working before and was in line with what I would expect.

      What do I need to do to get my extra stylesheet to be included with this build of smartgwt?

      Thanks,
      Chris

      Comment


        #4
        We have an engineer assigned to look into this, but just to clarify - your initial post said you were using a nightly dated 2012-09-04; since you didn't mention it, we presume this problem of not loading the correct stylesheet was not present in that build? It's important to know, because if there's a regression here it seems unlikely that it would have happened since the build of September 4th.

        Comment


          #5
          I don't have the 09/04 build loaded right now, but I don't recall seeing the regression in there.

          Comment


            #6
            Correction, I have not tested the 09/04 build with our app, I only used that build to verify the TextItem issue on a current smartgwt build. Prior to today, we have been running the build from 08/10. So the regression likely occurred sometime between then.

            Comment


              #7
              This was a regression, introduced when we added support for an extra additional stylesheet, specified on the actual request. The fix is now committed - please try your use case with tomorrow's 3.1d build.

              Regards,
              Isomorphic Software Support

              Comment


                #8
                I downloaded the 9/11/2012 build and it did correct the regression.

                Thank you for the fixes.

                Chris

                Comment

                Working...
                X