Announcement

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

    exportContent with Shiva skin

    Hello, I've tried to export as a PDF this grid:

    https://www-demos.smartclient.com/sm...izeIncrease=10

    with isc.RPCManager.exportContent, and the SVG icons doesn't show.

    Also I've tried in my application, in my local deployment I get this error:

    Code:
    2024-07-18T15:49:24,126 INFO PdfExport CharSet used: UTF-8
    2024-07-18T15:49:24,127 DEBUG PdfExport svgToConvert: <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="width: 13px;height: 13px;" class="icon" ><use xlink:href="https://localhost:8443/Jat/isomorphic/skins/Shiva/images/stockIcons.svg#arrow_upward" href="https://localhost:8443/Jat/isomorphic/skins/Shiva/images/stockIcons.svg#arrow_upward"></use></svg>
    2024-07-18T15:49:24,874 WARN PdfExport Caught unexpected exception
    org.apache.batik.bridge.BridgeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
        at org.apache.batik.bridge.BridgeContext.getReferencedNode(BridgeContext.java:788) ~[batik-bridge-1.11.jar:?]
        at org.apache.batik.bridge.BridgeContext.getReferencedElement(BridgeContext.java:804) ~[batik-bridge-1.11.jar:?]
        at org.apache.batik.bridge.SVGUseElementBridge.buildCompositeGraphicsNode(SVGUseElementBridge.java:124) ~[batik-bridge-1.11.jar:?]
        at org.apache.batik.bridge.SVGUseElementBridge.createGraphicsNode(SVGUseElementBridge.java:98) ~[batik-bridge-1.11.jar:?]
        at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode(GVTBuilder.java:213) ~[batik-bridge-1.11.jar:?]
        at org.apache.batik.bridge.GVTBuilder.buildComposite(GVTBuilder.java:171) ~[batik-bridge-1.11.jar:?]
        at org.apache.batik.bridge.GVTBuilder.build(GVTBuilder.java:82) ~[batik-bridge-1.11.jar:?]
        at com.isomorphic.contentexport.SvgImage.getRootNode(SvgImage.java:32) ~[isomorphic-content-export-13.1-d20240714.jar:?]
        at com.isomorphic.contentexport.SvgImage.<init>(SvgImage.java:42) ~[isomorphic-content-export-13.1-d20240714.jar:?]
        at com.isomorphic.contentexport.PdfExport.convertSvgImages(PdfExport.java:413) ~[isomorphic-content-export-13.1-d20240714.jar:?]
        at com.isomorphic.contentexport.PdfExport.convertAllSvgOccurrencesToBase64(PdfExport.java:402) ~[isomorphic-content-export-13.1-d20240714.jar:?]
        at com.isomorphic.contentexport.PdfExport.getPdfRenderer(PdfExport.java:298) [isomorphic-content-export-13.1-d20240714.jar:?]
        at com.isomorphic.contentexport.PdfExport.getPdfObject(PdfExport.java:78) [isomorphic-content-export-13.1-d20240714.jar:?]
        at com.isomorphic.rpc.BuiltinRPC.getPdfObject(BuiltinRPC.java:1361) [isomorphic-core-rpc-13.1-d20240712.jar:?]
    it's true that I'm not using a valid certificate, but I don't get the same error with Twilight for instance. Also, is actually the batik dependency required with modern browsers?
    Last edited by claudiobosticco; 18 Jul 2024, 08:49.

    #2
    As you've already figured out, yes, the problem is that Batik tries to download the SVG resources and the SSL certificate chain is invalid, so it can't do it. It doesn't happen for Twilight just because Twilight's icons are all PNGs.

    You've probably also figured out the different workarounds to get this working while using an invalid SSL certification, but just in case, here's a ChatGPT session that outlines them: https://chatgpt.com/share/3c29e08f-b...a-5406a8c78d1f

    As far as getting rid of Batik, aside from SVG icons, we need it for FacetCharts. There are ways to get around this, such as re-rendering all charts offscreen using a <canvas>, acquiring a data URL for a PNG from that <canvas>, and sending that to the server instead. That would work for icons as well. We have some prototype code for this, although it's imperfect: it's more data sent to the server, and a lower-quality rendering since it's no longer true vector graphics.

    However, if Batik continues to get in the way, you could use the Feature Sponsorship program to make this an official feature you could turn on - let us know.

    Comment


      #3
      Thanks for the clarification. For now, I am just testing the functionality. The presence of Batik is not an issue for me; I just mistakenly understood from reading the documentation that it wasn't necessary with modern browsers.

      I confirm that by disabling SSL validation locally, the export works. However, even locally, as in the example preDefinedHilites, the SVG icons are not visible in the PDF, you can try with this test case:

      Code:
      var ds = isc.DataSource.get("countryDS");
      
      // HTML for a "warning" icon to appear after certain hilites
      var iHTML = isc.Canvas.imgHTML("[SKIN]/actions/exclamation.png", 16, 16);
      
      // array of hilite-objects to apply to the grid
      var hiliteArray =
          [
              {
                  fieldName: "area",
                  cssText: "color:#FF0000;",
                  criteria: {
                      fieldName: "area",
                      operator: "greaterThan",
                      value: 5000000
                  }
              },
              {
                  fieldName:[
                      "area",
                      "gdp"
                  ],
                  cssText: "color:#FFFFFF;background-color:#639966;",
                  htmlAfter: iHTML,
                  criteria: {
                      _constructor: "AdvancedCriteria",
                      operator: "and",
                      criteria: [
                          {
                              fieldName: "gdp",
                              operator: "greaterThan",
                              value: 1000000
                          },
                          {
                              fieldName: "area",
                              operator: "lessThan",
                              value: 500000
                          }
                      ]
                  }
              }
          ]
      ;
      
      isc.VLayout.create({
          ID:"layout",
          width:600, height:250,
          membersMargin: 5,
          members: [
              isc.HLayout.create({
                  ID:"buttonLayout",
                  width:"*", height:30,
                  membersMargin: 10,
                  members: [
                      isc.IButton.create({
                          autoFit: true,
                          title: "Export PDF",
                          click: "isc.RPCManager.exportContent(countryList)"
                      })
                  ]
              })
          ]
      });
      
      // Create the initial ListGrid. See comment below for parameter description.
      recreateListGrid(true);
      
      // Function to create a new ListGrid. On the first call, passes "true" as the parameter, such
      // that the hiliteArray above is included in the create() statement. Subsequent calls pass false,
      // meaning no hiliteArray is included and a separate call to setHiliteState() is used instead.
      function recreateListGrid(includeHilites) {
          layout.addMember(isc.ListGrid.create({
              ID: "countryList",
              width:"100%", height:"*",
      
              dataSource: ds,
              autoFetchData: true,
              canAddFormulaFields: true,
              canAddSummaryFields: true,
              fields:[
                  {name:"countryCode", title:"Flag", width:60, type:"image", imageURLPrefix:"flags/24/",
                      imageURLSuffix:".png"
                  },
                  {name:"countryName", title:"Country"},
                  {name:"capital", title:"Capital"},
                  {name:"population", title:"Population"},
                  {name:"area", title:"Area"},
                  {name:"gdp"}
              ],
              hilites: includeHilites ? hiliteArray : null
          }));
      
      }

      Comment

      Working...
      X