Announcement

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

    showPrintPreview properties usage

    Hi Isomorphic,

    please see this slightly modified sample (original here https://www.smartclient.com/smartcli.../?id=pdfExport);

    Code:
    isc.ListGrid.create({
        ID: "countryList",
        width: 500, height: 350, 
        data: countryData,
        fields: [
            {name: "countryName", title: "Country"},
            {name: "capital", title: "Capital"},
            {name: "continent", title: "Continent"}
        ],
        canExpandRecords: true,
        expansionMode: "detailField",
        detailField: "background"
    });
    
    isc.IButton.create({ 
        ID : "buttonPdf",
        width: 150,
        title: "Export",  
        click : function () {
            // this sample exports to the Enterprise skin, and that skin defaults to 
            // alternate row styling but not alternate field styling - remember the 
            // alternate styling settings (from the current skin) and update them to
            // those required for Enterprise, via a call to setProperties().
            var oldAlternateRecordStyles = countryList.alternateRecordStyles;
            var oldAlternateFieldStyles = countryList.alternateFieldStyles;
            countryList.setProperties({
                alternateRecordStyles: true,
                alternateFieldStyles: false
            });
    
            var settings = {
                skinName: "Enterprise", 
                pdfName: "export"// without .pdf
            };
            isc.RPCManager.exportContent(mainLayout, settings);
    
            // reinstate the alternate styling settings from the current skin, on a short delay
            countryList.delayCall("setProperties", [{
                alternateRecordStyles: oldAlternateRecordStyles,
                alternateFieldStyles: oldAlternateFieldStyles
            }], 300);
        }
    });
    isc.IButton.create({ 
        ID : "buttonPreview",
        width: 150,
        title: "Show Print PreView",  
        click: function () {
            Canvas.showPrintPreview(mainLayout,null,{title: "München",printButtonTitle :"München"});
        }
    });
    isc.HLayout.create({
        ID: "hLayout",
        membersMargin: 5,
        members: [
            buttonPdf,
            buttonPreview
        ]
    });
    isc.VLayout.create({
        ID: "mainLayout",
        width: 500,
        membersMargin: 5,
        height: 350,
        members: [
            countryList,
            hLayout
        ]
    });
    countryList.expandRecord(countryList.data[2]);
    countryList.expandRecord(countryList.data[4]);
    Please see "buttonPreview". In the click function, I'm using the class API of Canvas now for the method showPrintPreview. As You can see, I wanted to change the Print Preview Window's title and the button Title, using printWindowProperties. Those properties only get applied if I use Canvas.showPrintPreview(mainLayout,null,{title: "München",printButtonTitle :"München"}); but it has no effect if I do this: mainLayout.showPrintPreview(mainLayout,null,{title: "München",printButtonTitle :"München"}); or mainLayout.showPrintPreview(null,null,{title: "München",printButtonTitle :"München"}); With either of the last two examples I also don't get an error message or something in the showcase.

    So first Question:
    I took a look at the reference docs, and they say, showPrintPreview is a method from the Canvas class API. Clearly one can call it from an instance of that class, like You do it in the example, and VLayout does inherit it, but why can I not apply the properties? When I use the class method directly it works as You can see in the above sample.

    Second Question:
    With that Code above, I open the Print Preview Window and the title and printButtonTitle properties get applied properly. When I click on the print button then and download the document as PDF the diacritics are not getting translated to HTML properly. Please take a look at this.

    Tested Browsers:
    • Chrome Version 76.0.3809.100
    • Firefox Quantum 68.0.1
    Microsoft Edge 42.17134.1.0 can translate the diacritics

    Thanks in Advance,
    Kind Regards

    #2
    The instance-level showPrintPreview is an internal, undocumented method which has a totally different signature. It was not mean to be shown in the sample code and will be removed.

    Where are you reporting a problem with diacritics? In the Showcase? Are you testing with a locale enabled?

    Comment


      #3
      As answer to
      Where are you reporting a problem with diacritics? In the Showcase? Are you testing with a locale enabled?
      I'm reporting the problem with diacritics in the showcase here https://www.smartclient.com/smartcli.../?id=pdfExport
      I tried with locale enabled like this:
      https://www.smartclient.com/smartcli...port&locale=de
      and without, like this:
      https://www.smartclient.com/smartcli.../?id=pdfExport

      I'm using this code:

      Code:
       
       isc.ListGrid.create({     ID: "countryList",     width: 500, height: 350,      data: countryData,     fields: [         {name: "countryName", title: "Country"},         {name: "capital", title: "Capital"},         {name: "continent", title: "Continent"}     ],     canExpandRecords: true,     expansionMode: "detailField",     detailField: "background" });  isc.IButton.create({      ID : "buttonPdf",     width: 150,     title: "Export",       click : function () {         // this sample exports to the Enterprise skin, and that skin defaults to          // alternate row styling but not alternate field styling - remember the          // alternate styling settings (from the current skin) and update them to         // those required for Enterprise, via a call to setProperties().         var oldAlternateRecordStyles = countryList.alternateRecordStyles;         var oldAlternateFieldStyles = countryList.alternateFieldStyles;         countryList.setProperties({             alternateRecordStyles: true,             alternateFieldStyles: false         });          var settings = {             skinName: "Enterprise",              pdfName: "export"// without .pdf         };         isc.RPCManager.exportContent(mainLayout, settings);          // reinstate the alternate styling settings from the current skin, on a short delay         countryList.delayCall("setProperties", [{             alternateRecordStyles: oldAlternateRecordStyles,             alternateFieldStyles: oldAlternateFieldStyles         }], 300);     } }); isc.IButton.create({      ID : "buttonPreview",     width: 150,     title: "Show Print PreView",       click: function () {         Canvas.showPrintPreview(mainLayout,null,{title: "München",printButtonTitle :"München"});     } }); isc.HLayout.create({     ID: "hLayout",     membersMargin: 5,     members: [         buttonPdf,         buttonPreview     ] }); isc.VLayout.create({     ID: "mainLayout",     width: 500,     membersMargin: 5,     height: 350,     members: [         countryList,         hLayout     ] }); countryList.expandRecord(countryList.data[2]); countryList.expandRecord(countryList.data[4]);


      and in both cases I get this (see the red highlight):

      Click image for larger version

Name:	showcase.png
Views:	164
Size:	278.0 KB
ID:	259089

      If I export it to PDF or print it directly, it makes no difference, I get the wrong translation, like in the red highlight

      Comment


        #4
        Hi Isomorphic! Any updates available on this ?

        Comment


          #5
          We can see the problem with print preview, when you print it title is not shown properly like in your screenshot. We are working on this and will let you know when this is fixed.

          You are telling though, that if you print to PDF directly the translation is wrong as well. What do you mean by this exactly, is it data that is displayed incorrectly? We can't see this, could you please provide detailed instructions how to reproduce the problem?

          Comment


            #6
            OK, thank You! With translation I basically mean that the diacritics are not properly resolved like in the print preview.

            Comment


              #7
              We understand what you mean by translation, but we can't reproduce the problem when printing directly to PDF (without preview). Whatever we do diacritics are properly displayed.

              That is why we are asking you for step by step instructions on how to reproduce. Thank you.

              Comment


                #8
                I think there was a misunderstanding. From my point of view there is now problem with printing directly to PDF (no problems with "Export"). It's just the diacritics within print preview. Sorry for misunderstanding

                Comment


                  #9
                  The problem with print preview title encoding is solved. The fix will be available for download in nightly builds since Sep 18 (tomorrow).

                  Comment

                  Working...
                  X