跳至主內容

搜尋

搜尋

Can't Do A Print Preview From Print Dialog?

評論

5 條評論

  • Avatar
    Ian Cummings
    版主

    You'd probably want to make use of the Application.VisibleWindows Property until you get the result you want.

     
    Description 
    Sets which components of the BarTender application will be visible when it runs.
     
    Syntax 
    Application.VisibleWindows = BarTender.BtVisibleWindows.visibleWindowState 
     
    Where visibleWindowState can be set to one of the following:
     
    • btNone. No BarTender visibility; this is the default setting for the VisibleWindows property.
     
    • btAll. Full BarTender visibility, including main windows and all interactive dialogs.
     
    • btInteractiveDialogs. BarTender visibility constrained to interactive dialogs and messages. The BarTender main user interface will not be visible.
     
    • btStartingLabelDialogOnly. BarTender visibility constrained to only the Starting Label dialog.
    0
  • Avatar
    Legacy Poster

    I already had btInteractiveDialogs set, when having the problem as described.

     

    btAll seems unsuitable, because it brings up the designer window for the format.

     

    btStartingLabelDialogOnly does not allow preview at all, but at least the Preview button is disabled.

     

    With btInteractiveDialogs set, it is almost as if the preview cannot display, and later it causes bartender.exe to not terminate on program exit - as if it is hung trying to do something.

    0
  • Avatar
    Ian Cummings
    版主

    Therefore doing a print preview within BarTender is not the way to go.  It just doesn't work the way you want.  Sorry.

     

    It should be noted that the Enterprise Automation edition supports a ExportPrintPreviewToImage method for producing a print preview within your application.  This should be your ideal route to producing a print preview to give the user experience you want.  Here is an example of its use in C#:

    // Declare a BarTender application variable  
    BarTender.Application btApp; 
    
    // Declare a BarTender document variable  
    BarTender.Format btFormat; 
    
    // Declare a BarTender messages variable  
    BarTender.Messages msgs; 
    
    // Create a new instance of BarTender  
    btApp = new BarTender.Application();
    
    // Set the BarTender application visible 
    btApp.Visible = true;
    
    // Open a BarTender document 
    btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");
    
    // Export document to a print preview 
    BarTender.BtPrintResult res; 
    
    res = btFormat.ExportPrintPreviewToImage("c:\\", "Label_%PageNumber%_Preview.jpg", "jpg", BarTender.BtColors.btColors24Bit, 200, 13117215, BarTender.BtSaveOptions.btSaveChanges, true, true, out msgs);
    
    // End the BarTender process  
    btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges); 
    
    
    0
  • Avatar
    Legacy Poster

    I can provide Print Preview just fine, as a separate option in my program, by doing PrintPreview.ShowDialog, as explained in my first post; no need to do ExportPrintPreviewToImage.

     

    What I was concerned about was that PrintOut() was allowing the user to click a PrintPreview button within the print dialog, but nothing was happening, and it caused the bartender.exe instance to hang around at program termination.

     

    I can set btStartingLabelDialogOnly to keep the user from doing that, so I am good for now.

     

    I think that allowing a print preview button click with no resulting print preview and not being able to subsequently terminate BarTender.exe with a .Quit is a bug of some sort.

     

    I will probably test later from C# and see if I have the same issue.  Is there such a thing as bug reporting for BarTender?

     

    Thanks for your prompt attention and help.

    0
  • Avatar
    Ian Cummings
    版主

    This sort of problem is known, but unfortunately there is not much we can do about it save showing the whole BarTender application.  It's just not the recommended way of doing things.

    0

登入寫評論。