Announcement

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

    How to combine components before printing them.

    Hi,

    I have a simple question. Before printing some component to pdf I'd like to reorganize some view elements. For example I have a Canvas which has a DynamicForm and ListGrid as children.

    I want to define a new Canvas only for the print, add some Labels to it and the ListGrid from the previous Canvas (the original one which is currently shown). To add the ListGrid as a child from the first Canvas to the second one is not the solution (it brings errors.)

    Could you please give me some hints how to realize that issue?

    Cheers,
    zapryano

    #2
    The simplest solution would probably be to simply pass in the components you want to print, optionally along with some raw HTML to the "showPrintPreview()" method. This is pretty flexible - it'll allow you to show print HTML from a mixture of already drawn widgets (your ListGrid for example) and other things like custom Labels which should only show up in the print view.

    If you want to actually build out a full UI of components to pass into the print view your options are to either rework the existing UI (re-parenting your ListGrid as long as the print view is up, for example), or just create a new entirely parallel UI only for printing (in that case you'd create a new ListGrid, for printing only, with the appropriate set of fields / data, etc)

    Comment


      #3
      Hi,

      thank you for your answer.

      I use Canvas.showPrintPreview() in cases for showing print preview, it is a void method and I cannot use the result from it.
      What I need is to create directly pdf with
      RPCManager.exportContent(Canvas, requestProperties); without showing any preview. The big difference for me between showPrintPreview() and exportContent() is that the first one accept Canvas and Canvas[] and the exportContent() only one object and not an array as input parameter, therefore I tried to create only one Canvas object form different parts of the UI.

      Creating parallel UI only for printig to pdf reasons is one solution, but I'd do it only if there are no other possibilities.

      Thanks,
      zapryano

      Comment


        #4
        Ah that makes sense - you didn't mention you were exporting to PDF.
        We'll look into whether a signature change for exportContent() makes sense, but in the mean time you can simply use getPrintHTML() to get the actual HTML you care about [that method does take an array of canvases as a parameter].
        You can then embed that HTML into a Canvas / pass to exportContent()

        Regards
        Isomorphic Software

        Comment

        Working...
        X