rreHardCopy - print the contents of a fld

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: rreHardCopy - print the contents of a fld

Post by quailcreek » Tue Jun 09, 2015 1:18 am

Hi Jacqueline,
This is an iSO app. hence all the printing. I can upload the stack if you want to take a look.
Tom
MacBook Pro OS Mojave 10.14

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: rreHardCopy - print the contents of a fld

Post by jacque » Tue Jun 09, 2015 9:22 am

Now that you have the printing stack figured out for iOS, move back to the Mac to test the actual printouts. Once they work, go back to IOS for final testing. It's way easier that way.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: rreHardCopy - print the contents of a fld

Post by quailcreek » Tue Jun 09, 2015 4:43 pm

Doh! I've been so wrapped around the axle about this app being iOS I didn't think about doing that. Thanks again J,
Tom
MacBook Pro OS Mojave 10.14

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: rreHardCopy - print the contents of a fld

Post by quailcreek » Tue Jun 09, 2015 7:44 pm

I filed a bug report on the print margin issue. No matter what I set the right and bottom margins to it has no affect on the output in the PDF.
Tom
MacBook Pro OS Mojave 10.14

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7390
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: rreHardCopy - print the contents of a fld

Post by jacque » Tue Jun 09, 2015 7:49 pm

quailcreek wrote:Doh! I've been so wrapped around the axle about this app being iOS I didn't think about doing that. Thanks again J,
Yeah, brain freeze. Been there. At least you'll never get caught up like that again. Next time it will be something else. :)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

quailcreek
Posts: 746
Joined: Sun Feb 04, 2007 11:01 pm

Re: rreHardCopy - print the contents of a fld

Post by quailcreek » Wed Jun 10, 2015 9:31 pm

So here's what I ended up with. The reason for setting the height of the fld is because there are text lines in the fld which can be more than one sentence long but would still be counted as "a line". That's why using the num of lines or something like it won't work right. Also, the bug report regarding setting the printMargins when using print to pdf having no affect, came back as "not a bug'. What I needed to do was set the size of the printFld to 2x27 smaller instead of just 27 smaller on the right and bottom. I also had to tweak the printFld bottom a few pixels shorter to accommodate the textSize and fixed line height setting. This was to eliminate any partial lines at the bottom of the pages. This took me quite awhile to work through so I wanted to share what I came up with to help spare others the heartburn. Thanks again to Jacqueline for her help.

Code: Select all

open printing to pdf tPDFFile
   if there is a stack tPrintPath then
      
      put the pageHeights of fld "PrintFld" of cd 1 of stack tPrintPath into tFldHeight
      set the vScroll of fld "PrintFld" of cd 1 of stack tPrintPath to 0
      put the num of lines of tFldHeight into tPageCount
      
      put zero into tTotalScroll
      repeat with xLines = 1 to tPageCount
         add line xlines of tFldHeight to tTotalScroll
      end repeat
      
      repeat with nLines = 1 to tPageCount
         if nLines is 1 then
            print cd 1 of stack tPrintPath
         else
            if nLines = tPageCount then ## The last page to print
               set the Height of fld "PrintFld" of cd 1 of stack tPrintPath to (line nLines of tFldHeight)
               set the vScroll of fld "printFld"  of cd 1 of stack tPrintPath to tTotalScroll
               print cd 1 of stack tPrintPath
            else
               put the vScroll of fld "printFld"  of cd 1 of stack tPrintPath into tCurrentScroll
               set the vScroll of fld "printFld"  of cd 1 of stack tPrintPath to (tCurrentScroll + line nLines of tFldHeight)
               print cd 1 of stack tPrintPath
            end if
         end if
      end repeat
   else
      answer the result
   end if
   close printing
Tom
MacBook Pro OS Mojave 10.14

Post Reply