Print to PDF of multi-tabbed form

User c1ce6b3d19

24-08-2012 22:32:11

When you print or print to file (e.g. PDF) a form that has multiple tabs, only the currently selected tabs are printed.  


You can print multiple times after selecting each tab and perhaps merge the files, but this is not scalable. 


Is it possible to automate this printing to a PDF all of the tabs?  If possible, perhaps you can show how to do this in a groovy script?


 


Thanks,


Jon

ChemAxon fa971619eb

25-08-2012 14:57:22

I don't think this would be at all easy. In principle its possible, but its difficutl to see how you would handle the layout of the different tabs in a generic manner that handled all form designs. Another related limitation is scrolbars in tables. Paper doesn't handle tabs or scroll bars well!


I think its better to think of creating a form specifically for the purpose of printing that didn't use tabs. You can use the normal form for viewing data, and when you want to print switch to the print from and print that.


Tim

User f914e5718c

25-08-2012 18:36:34

Hi Tim,


We were thinking about this in a very specific manner.


Each tab is like a separate page -- so just like the current tab prints to a single page, we would just like the option that all tabs print to separate page.


I.e. the layout is just as simple as a single tab on a page.


Brock.


P.S.  We will be back to ask for the scrollbars to work on a paper printout later -- I am sure someone will ask :)

ChemAxon fa971619eb

27-08-2012 07:03:41

I don't know how feasible this is - I'll need to ask.


Tim 

User f914e5718c

14-09-2012 20:19:09

Tim -- didn't hear back from you -- hoping that you got a chance to talk w/ the developers about this.

ChemAxon e189db4705

17-09-2012 22:02:03

Hi,


generic solution is really pretty complex as it was said earlier. We can look at implementation of a special case when there is only one widget in the form - one tabbed pane. I added it to our bugtracking system last week, but I'm afraid we won't be able to resolve this in the following release, probably sometimes later.


I tried to create a simple script which uses. How to use it:



A few more comments:



import com.im.ijc.core.api.cookie.*;
import org.openide.*;

// Fill form name - can be done using chooser. Form must be opened when running this script
form = dataTree.views.items.find { it.name == "Tabs" }
topComponent = AbstractViewTopComponent.viewRegistry.getIfOpened(form)
printer = topComponent.lookup.lookup(AdvancedPrintCookie.class)

// expecting form contains only one widget which is the tabbed pane
handle = topComponent.widgetContainer.getWidgets(true).iterator().next()
tabbedPane = handle.widget.browseModeComponent
for (int i = 0; i < tabbedPane.tabCount; i++) {
    tabbedPane.selectedIndex = i
    printer.printToFile()
    // need modal dialog to wait till previous tab is printed
    name = tabbedPane.getTitleAt(i)
    DialogDisplayer.default.notify(new NotifyDescriptor.Message("Confirm tab $name printed"))
}

 


 


Petr

User c1ce6b3d19

15-10-2012 22:18:19

This works basically as described.  Thanks, but we are looking for something more automated (no print dialogs) and/or row-centric (one pdf file for each row).  


In this groovy script scenario, is there a way to automatically fill out the print dialog?


For example, I would like to print each tab by selecting the current row using the previous or saved print dialog selections.  Perhaps the name of the file can be generated using information on the form and passed to the print dialog.  

ChemAxon e189db4705

04-11-2012 21:53:15

Hi Jon,


I'm sorry for late response. We've already added this into the task list. And we are going to look at it in one of upcoming relelases.


I think putting information from each row and printing one row into one file might be more difficult. We are going to investigate the option when a form has only one tabbed panel then each will be printed on a separate page into the same file or printing queue.


Regards,


Petr