Printing card not getting the correct height

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Printing card not getting the correct height

Post by jalz » Wed Dec 23, 2015 11:25 pm

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


MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Printing card not getting the correct height

Post by MaxV » Wed Dec 30, 2015 10:32 am

What is setVisiblePrintBar ?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

jalz
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 340
Joined: Fri Sep 12, 2008 11:04 pm

Re: Printing card not getting the correct height

Post by jalz » Wed Dec 30, 2015 3:22 pm

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

lutimusmith
Posts: 1
Joined: Tue Oct 16, 2018 11:13 am

Re: Printing card not getting the correct height

Post by lutimusmith » Tue Oct 16, 2018 11:21 am

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?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9580
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Printing card not getting the correct height

Post by dunbarx » Tue Oct 16, 2018 1:51 pm

Lutismusmith.

You are in the wrong forum.

This is about the LiveCode programming environment, not Java.

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Printing card not getting the correct height

Post by bogs » Tue Oct 16, 2018 3:51 pm

I believe it is a bot, Craig :wink:
Image

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”