why does all my printing break when its a Revlet?

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
scott47303
Posts: 17
Joined: Tue Aug 10, 2010 3:16 pm

why does all my printing break when its a Revlet?

Post by scott47303 » Thu Apr 21, 2011 9:20 pm

Very frustrated with the web player right now. nothing prints as it does in dev or compiled exe.

First i used revprintfield works great, but in revlet the font and size is too big, and stays the same no matter how you try to change it.

so i tried building a new substact which to print from, and use print stack or print card, now i am just getting a blank page. is this known bugs in the web player?

Also, the printpaperorientation set to landscape never works the first time, but you print again and it works.

here is what i'm using to print

on printTheReport
revShowPrintDialog false, true
set the printpaperorientation to "landscape"
print all cards
close printing
end printTheReport

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Re: why does all my printing break when its a Revlet?

Post by Janschenkel » Fri Apr 22, 2011 6:25 am

Try something like this:

Code: Select all

on printTheReport
   set the printPaperOrientation to "landscape" 
   answer page setup
   if the result is "Cancel" then exit printTheReport
   open printing with dialog
   if the result is "Cancel" then exit printTheReport
   print all cards
   close printing
end printTheReport
'revShowPrintDialog' was only meant for use in combination with 'revPrintText'/'revPrintField'. You should set the 'printPaperOrientation' before the 'open printing' command, as you can't change it in the middle of the print job. Oh, and a graceful exit is always nice when the user click the 'Cancel' button :-)

HTH,

Jan Schenkel
Quartam Reports & PDF Library for LiveCode
www.quartam.com

scott47303
Posts: 17
Joined: Tue Aug 10, 2010 3:16 pm

Re: why does all my printing break when its a Revlet?

Post by scott47303 » Mon Apr 25, 2011 7:29 pm

ok i used your code and my page is not blank now, thank you. But the printer dialog does not appear, it just prints, and the landscape does not work at all in dev or web?

scott47303
Posts: 17
Joined: Tue Aug 10, 2010 3:16 pm

Re: why does all my printing break when its a Revlet?

Post by scott47303 » Tue Apr 26, 2011 6:57 pm

ok I have this printing pretty good as long as the stack is only one card. in dev and exe it works great. in Web form one card works great. if the stack is more than one card, the revelet prints only 1 blank page. i tried print stack and print all cards same result. both work in Dev fine. Here is what i got now, works great in dev, in revlet form I can get the first page to print and then a blank page, and thats it even if there is 10 cards. is this a bug in the web player?

this prints one blank when a revlet, works fine in Dev
on printTheReport
set the printPaperOrientation to "landscape"
answer page setup
if the result is "Cancel" then exit printTheReport
open printing with dialog
if the result is "Cancel" then exit printTheReport
print all cards
close printing
end printTheReport



this works in dev 3 cards. prints 1 card and 1 blank when a revlet
on printTheReport
global gcardstoprint
put the number of cards in stack "printstack" into gcardstoprint
set the printPaperOrientation to "landscape"
set the printMargins to 1,1,1,1
open printing with dialog
if the result is "Cancel" then exit printTheReport
repeat until gcardstoprint = 0
print card gcardstoprint
subtract 1 from gcardstoprint
end repeat
close printing

scott47303
Posts: 17
Joined: Tue Aug 10, 2010 3:16 pm

Re: why does all my printing break when its a Revlet?

Post by scott47303 » Fri Apr 29, 2011 7:43 pm

I was able to fix my problems with a workaround. it seems the web player does not like multiple stacks, and if you are printing it likes the card you're printing to be the 'active' card. here is the full code of my print button that works in web form. This is already the second "bug" i have found in the web player, and i have not been doing this long.



on mouseUp
global gcardNum
global gprintheight
initforprinting
put field "table1" of card 3 into field "holdContents" of card 4
put the number of lines of field "holdContents" of card 4 into tNumLines
put the height of field "printContents" of card 4 into gPrintHeight
put 4 into gcardNum
go to card 4
repeat
fillOneCard
if the number of lines of field "holdContents" of card 4 = 0 then
exit repeat
end if
create card
put gcardNum + 1 into gcardNum
end repeat
printTheReport
end mouseUp

on initforprinting
global gcardNum
global gprintheight
put empty into gcardNum
put empty into fld "holdContents" of card 4
put empty into fld "PrintContents" of card 4
put empty into fld "orderscurrent" of card 4
put empty into fld "ordersprioryear" of card 4
put empty into fld "ordersYTD" of card 4
put empty into fld "ordersYTDPrior" of card 4
repeat until the number of cards = 4
put the number of cards into tcards
delete card tcards
end repeat
end initforprinting


on fillOneCard
global gcardNum
global gprintHeight
repeat until the formattedHeight of field "printContents" of card gcardNum >= gPrintHeight
put line 1 of field "holdContents" of card 4 & return after field "printContents" of card gcardNum
delete line 1 of field "holdContents" of card 4
end repeat
put fld "reportname" of card 3 into fld "reportname" of card gcardNum
put fld "daterange" of card 3 into fld "daterange" of card gcardNum
put fld "orderscurrent" of card 3 into fld "orderscurrent" of card gcardNum
put fld "ordersprioryear" of card 3 into fld "ordersprioryear" of card gcardNum
put fld "ordersYTD" of card 3 into fld "ordersYTD" of card gcardNum
put fld "ordersYTDPrior" of card 3 into fld "ordersYTDPrior" of card gcardNum
end fillOneCard

on printTheReport
global gcardstoprint
put the number of cards into gcardstoprint
set the printPaperOrientation to "landscape"
set the printMargins to 1,1,1,1
open printing with dialog
if the result is "Cancel" then exit printTheReport
repeat until gcardstoprint = 3
print card gcardstoprint
subtract 1 from gcardstoprint
end repeat
close printing
go to card 3

end printTheReport

Post Reply