Announcement

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

    Couple of questions on PDF Export

    Hi, I am using v8.3p_2013-03-13/Pro Development Only (built 2013-03-13).

    I have a couple of questions regarding exporting to PDF in Smart Client. I am trying to understand when I can just use exportContent in JS versus using PDFExport on the server side. Could you also help identify which (if any) of these items are bugs and which are features that are not implemented?

    1. I am trying to omit and include controls in an exported PDF. I tried calling exportContent() with an array of Canvas as the first argument, but this doesn't work since exportContent() only seems to take a Canvas as an argument.
    I also tried calling getPrintHTML() and passing in printProperties with omit and included controls, but the returned HTML in the callback function always returns ALL the HTML regardless (including buttons and tabs) and ignoring the printProperties set. How do I go about omitting and including controls in the PDF?

    2. I want to generate the PDF in Landscape since the content is too wide to fit nicely in Portrait. How would I do this?

    3. Looks like I can't set exportDisplay to be window instead of download. Is this not supported now from the client side? Is there some way to do this on the server side using PDFExport?

    Code:
    isc.Button.create({
    	ID: "pdfPrint",
    	title: "Export PDF",
    	left:25,
    	top: 16,
    	width: 90,
        click:function () {
    		var printProperties = {
    			omitControls: [TabSet],
    			printForExport: true
    		};
    		var settings = {
    			skinName: "SilverWave", 
    			exportFilename: "export",
    			exportDisplay: "window"//Doesn't work
    		};
    		pageLayout.getPrintHTML(printProperties, function(HTML) {
    			exportHTMLCanvas.setContents("<div id='pageHeader'>My header</div>" + HTML);
    			isc.RPCManager.exportContent(exportHTMLCanvas, settings);
    		});
    	}
    });

    #2
    1. We already covered this. Yes it's a bug, it was actually fixed today, so try tomorrow's nightly build.

    Your usage of omit controls is wrong, "TabSet" should a String, and if you want Buttons et al omitted, you need to specify that. omitControls is the complete list of classes to omit, not an addition to an existing list.

    2. You'd need to use iText APIs no adjust the PDF object returned by our PDFExport classes - see iText docs.

    3. What part of exportDisplay:"window" "doesn't work"?

    Comment


      #3
      Thanks for your prompt responses. That is great! I will check the new build out.

      Regarding exportDisplay, it basically still seems to download the PDF instead of opening the PDF in a new browser window. I tried Chrome and FF.

      Comment


        #4
        Update: I have tried the latest version (v8.3p_2013-03-18/Pro Development Only) and can now pass an array of Canvases to exportContent. It loads everything in the array from top to bottom in the PDF irrespective of where they are positioned on the page. I believe this makes sense but wanted to confirm this is how it is supposed to work.

        I have also tried exportDisplay to "window" for excel and csv files. It seems like this only displays the results in a new window when using exportAs set to "csv" and exportData(). In all other situations, it seems to download the exports. These include all exportClientData calls (xls, xlsx, csv), exportData calls with excel (xls, xlsx) and exportContent (pdf). I even tried setting downloadResult and downloadToNewWindow to true. I was just wondering if all these other cases are as expected or maybe depend on the browser.

        Below is a code snippet for exporting as xls to a new window.
        Code:
        myList.exportClientData({ exportAs: "xls", exportDisplay: "window", downloadResult: true, downloadToNewWindow: true, lineBreakStyle: "dos", exportValueFields: true});
            }

        Comment


          #5
          We're doing the same thing for all export formats. What happens next depends on whether you have certain viewer apps installed (Adobe Acrobat, Excel), whether the browser has built-in viewers (some do for .pdf) and whether you've previously told the browser to always download or always view files with those extensions.

          Comment

          Working...
          X