Page 1 of 1

Printing card not getting the correct height

Posted: Wed Dec 23, 2015 11:25 pm
by jalz
Hi Guys

I have the following script, which seems to be working unto a point. No matter what I can't seem to print the full height of the card. I have designed the card with a navigation area at the top which takes about 50pts, so I want the top of the card to start at 55. My card has been designed for an A4 page, so my tPageSize should contain 842. I Add 55 to this and get 897 for the bottom of the card I want to print. Just to try and get it working, I tried printing from 0,55 to 1000, 1000 but I still don't capture the bottom of the card, Anyone got any ideas where I could be going wrong.

Thanks
Jalz

Code: Select all

global gPageOrientation, gMarginLeft, gMarginTop, gMarginRight, gMarginBottom

on mouseUp 
   set the printPaperOrientation to gPageOrientation
   --set the printMargins to gMarginLeft, gMarginTop, gMarginRight, gMarginBottom
   put printPaperSize into tPageSize
   set itemdelimiter to comma
   
   if gPageOrientation is "Portrait" then
      put item 1 of tPageSize into tPageWidth
      put item 2 of tPageSize into tPageHeight
   else
      put item 1 of tPageSize into tPageHeight
      put item 2 of tPageSize into tPageWidth
   end if
   
   open printing with dialog
   
   set the printMargins to 0,0,0,0
   
   if the result is "Cancel" then exit mouseUp
   
   lock screen
   
   repeat with i = 1 to number of cards
      put the short name of this card of stack "Print" into tCardName
      put "Grp_"  & tCardName into tGrpName
      
      put the vScroll of group tGrpName into tScrollPosition
      
      setVisiblePrintBar false
      
      set the backgroundcolor of this card to "white"
      
      set the borderwidth of graphic "paper" to 0
      //set the borderColor of object to {empty | colorName | RGBColor}
      
      set the vScroll of group tGrpName to 0
      
      --leftTop --rightBottom
      print card i from 1,55 to  1000 , 1000 -- 597,897
      
      set the vScroll of group tGrpName to tScrollPosition
      
      set the backgroundcolor of this card to empty
      
      set the borderwidth of graphic "paper" to 1
      
      setVisiblePrintBar true
      
   end repeat 
   
   unlock screen
   
   close printing -- sends job to printer
   
end mouseUp


Re: Printing card not getting the correct height

Posted: Wed Dec 30, 2015 10:32 am
by MaxV
What is setVisiblePrintBar ?

Re: Printing card not getting the correct height

Posted: Wed Dec 30, 2015 3:22 pm
by jalz
Hi Max, thanks for replying. Figured it out after a lot of head scratching. It was my scroll bar area I created stopping the full height of the print out. All sorted now :D

Best
Jalz

Re: Printing card not getting the correct height

Posted: Tue Oct 16, 2018 11:21 am
by lutimusmith
Hello MaxV,

I'm only new to Java GUI Programming and I'm having an issue that the parts inside my board are missing when I put the setVisible()function toward the start of the capacity called by the constructor, however, it works fine when it is toward the end. See code underneath:

Code: Select all

public static void main(String[] args) 
{
    new MainClass();
}

public MainClass()
{ 
    setFrame();
}

private void setFrame()
{
    JFrame frame = new JFrame();

    frame.setSize(400,400);
    frame.setResizable(false);
    frame.setVisible(true);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

   // Some area where the object of my components inside the panel is created and initialized.
   // If I just place a label and a button, it will appear on the panel. However, if I add the JTextArea, all the components in my panel is gone. Just like the code below.

    textArea1 = new JTextArea(20,34);
    textArea1.setWrapStyleWord(true);
    textArea1.setLineWrap(true);
    JScrollPane scroll = 
            new JScrollPane(textArea1, 
                    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, 
                    JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    panel.add(scroll);
    frame.add(panel);
    // Works fine when setVisible(true); it placed here.
}

What could the issue potentially be with respect to putting the setVisible() capacity to the start or to the finish of the strategy?

Re: Printing card not getting the correct height

Posted: Tue Oct 16, 2018 1:51 pm
by dunbarx
Lutismusmith.

You are in the wrong forum.

This is about the LiveCode programming environment, not Java.

Re: Printing card not getting the correct height

Posted: Tue Oct 16, 2018 3:51 pm
by bogs
I believe it is a bot, Craig :wink: