How print pages in spécific order

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Partenaire
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 33
Joined: Tue Apr 17, 2012 9:50 am

How print pages in spécific order

Post by Partenaire » Mon Jul 30, 2012 9:30 pm

Hi,

I have a headLock this week-end (i try to set this property to False without success:))

my goal is print page like in impostor.

the printRanges don't get the right result.

In Dictionary
Note that LiveCode automatically handles coalescing overlapping ranges, e.g. 1-10,5-25,23 will result in the range being 1-25.
I use revPrintField.

Print field give (for exemple) 8 pages
I would like print page in this order
p 8 after p1
p 6 after p3
p 4 after p 5
p2 after p7

The print Properties are
pageSetUp A4 and "portrait"
Pages peer sheet 2

Other question
How use the function "the printPageNumber"?

Warms regards

Eric

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10356
Joined: Wed May 06, 2009 2:28 pm

Re: How print pages in spécific order

Post by dunbarx » Mon Jul 30, 2012 11:41 pm

How is your stack laid out? Are there two fields on each card, or one? Or something entirely different?

"revPrintField" only prints fields. It seems you want to print cards, or some sort of report.

So unless you purchase a report program, such as the one from Quartram. I think you have to build the print templates yourself. If your current stack layout is not conducive, you can create a substack that is laid out visually the way you want, perhaps with two fields on a card. You can then load those fields in the order that you wish, and print the cards.

Note that you can pre-load the entire process so that only one print command is required. Read up on the "open printing" command in the dictionary. This allows you to queue all four cards at once.

Write back if you get stuck.

Craig Newman

Partenaire
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 33
Joined: Tue Apr 17, 2012 9:50 am

Re: How print pages in spécific order

Post by Partenaire » Tue Jul 31, 2012 12:28 pm

Hi Craig,

I have only one card in my Stack.

My stack is like the great stack "The Gutenberg reader" of Peter BrigHam.

I use Quartam report (nice program) but i don't try with.

When i use print card with this code , i have not excately what i want
on mouseUp
--set the systemPrintSelector to true
-- NOTE set page A4, "portrait" and pages peer sheet 2
answer page setUp
answer "Ne pas oublier : choisir le format portrait et 2 pages par page"
answer printer

put the pageHeights of fld "text1" into tHeightslist
put the number of lines of tHeightsList into tNumpages
set the scroll of fld "text1" to 0
open Printing
repeat --for each line L in tHeightsList
add 1 to tPAgeLine
add 1 to tPAgeNumber
--set the height of fld "text1" to line tPageLine of tHeightslist
add line tpageLine of tHeightslist to tScrolling

print this card from the topLeft of fld "text1" to the bottomRight of fld "Text1" \
into 0,0, item 3 of the printRectangle, item 4 of the printRectangle
put tPageNumber into fld "status"
if tPAgeLine = tNumpages then exit repeat
print break
set the scroll of fld "text1" to tscrolling
end repeat
close Printing
end mouseUp
- text on every card is not accurate, sometime i have a repeat line in next page
- No page number

So, maybe the right way is working with "revPrintField" or maybe LiveCode can do this stuff and need to use AppleScript.

But here , i am stuck.

Partenaire
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 33
Joined: Tue Apr 17, 2012 9:50 am

Re: How print pages in spécific order

Post by Partenaire » Tue Jul 31, 2012 2:47 pm

The code to print field is :

Code: Select all

on mouseUp
   answer page setUp
   answer printer
   put the printPageNumber into fld "status"
   
   put the htmlText of field "Text1" into tBodyHtmlText
   put "Page: <%pageNumber%> of <%numPages%>" into tFooterText
   --
   open printing
   put the printPageNumber into fld "status"
   revPrintText tBodyHtmlText, empty, tFooterText
   --print break 
   close printing
end mouseUp
the printPageNumber give nothing into the fld "status"! and i don't know where and how set the loop to intercepted the page number.

Thanks for yours help

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10356
Joined: Wed May 06, 2009 2:28 pm

Re: How print pages in spécific order

Post by dunbarx » Tue Aug 07, 2012 4:09 am

I have never used this, but reading the dictionary, it seems that a multi-page print job must be opened with the "open printing" command. There isn't a "loop" in the normal sense, but I think you probably know that. Anyway, this property returns empty if there is no "loop", that is, only a single page is to be printed.

Does your job have only one page? Perhaps this is why you are getting empty.

Just guessing,

Craig Newman

Post Reply