Page 1 of 1
Printing formatted images/text
Posted: Mon Apr 01, 2013 5:06 pm
by Traxgeek
Hi,
I've gotten to the stage where I'd like to add print functionality to the app I'm writing.
I've read as much as I can find and am still stumped. I thought I'd post a question here, explaining what I'm trying to achieve, and then, hopefully, with some pointers, be able to make some progress from there...
I don't have any real issues printing a card (or group of cards) and I can 'scale' them.
I DO have a problem trying to print from a datagrid (which took me an age to 'suss' out...).
My datagrid typically has various text and image objects. Ideally I'd use something like revPrintDataGrid - which would keep my carefull laid out formatting. But, of course, this doesn't exist !
Can someone point me in the right direction as to how to print mixed image / text data please in a format I'd like (X/Y coords and size of graphics etc) ?
I'm sure, once understood, this SHOULD be pretty simple - but I have failed to understand / locate sufficiently simple info. with regards to printing form DataGrids (I remain a RR/LC rookie !

). I can extract the DataGrid Info and I can print the data but no formatting and no graphics just their fiule names / IDs.
As always, all help enthusiastically received !
A million thanks.
Regards.
Re: Printing formatted images/text
Posted: Wed Apr 03, 2013 6:40 pm
by Traxgeek
Hmmm...
I don't know if my original message was too obtuse, considered to be too simple or simply too hard (I doubt that !!)
Seriously, I have looked at the examples, perused the tutorials, searched the forum and googled for help / where to start ideas/pointers with respect to printing mixed text and images and/or creating mixed image/text reports...
Sure I've found a couple of externals, but, I'm too particular for that and really want to suss this out properly so that I can get EXACTLY what I'd like to see and not rely on an 'external' that may give me approximately what I'd like. I'm willing to spend time learning BUT I can't even find where to being / a tutorial on formatting mixed text / images for reports or printing...
and... well, I'm lost...
It cannot be THAT difficult BUT it IS to me

(like I say, I'm still a newbie to LC).
Can anyone provide me with 'just' a pointer on where to go / how to start with creating a printout where images and text are where I want them to be on the same page ?
Please ? Pretty please ?
Thanks a mil. I really do appreciate it.
Re: Printing formatted images/text
Posted: Wed Apr 03, 2013 7:55 pm
by Simon
Hi Trax,
I'm guessing that you haven't received a reply because you are at the "fun" bit of LC programming (figuring out DG's and printing is a bother).
Just from your posts it looks like you have all the information you need to solve this problem, the original text and the image filename. Now you just need to format everything which you must have done most of when you got your DG's looking nice. The same ideas apply to your print card. Image name/location/size, font style/size/location all have to rebuilt for a print output.
I could be very wrong as I haven't done DG to print.
If you are still stuck then post a sample of your DG and print code.
Simon
Re: Printing formatted images/text
Posted: Wed Apr 03, 2013 8:35 pm
by Traxgeek
Thanks Simon,
I do indeed have all the data I need (like you say it's in the DG)
I can print the card or just the DG (using print card) - no problems there either BUT, the info I'm missing is the commands and syntax to use...
Initially I thought maybe I'd use something like
open print
print 'SomeField' at X,Y
print 'SomeOtherField' at X1, Y1
print 'SomeImage' at X,Y
-- and so on...
close print
but I can't get this going at all, although I did find some 'print...at...' lines of code from an older RR post...
Reading more into this and looking at your answer...
Would it be better to create a Print 'Card' for the data I'm trying to print. Is this the 'norm' / 'defacto' method or am I still barking up the wrong tree ?
If a Print Card is indeed 'the way to go' then how would I print data that is NOT on the card - I mean, if a DG is too long then we get horizontal / vertical scroll bars, how would I print data that needs to be 'scrolled' to / is off the standard card? Or (light bulb - not too sure if it's too bright tho') would I make my print card / DG as long as I need to in that it wouldn't need to be visible anyway (then just print my (potentially) very long/too big for the display card) ?
I'm really sorry about this, but I 'm not too sure where to start - do I continue with 'print...at...' or do I start a Print Card with a print DG on it... ?
Thanks for your help.
REALLY appreciated !
Re: Printing formatted images/text
Posted: Wed Apr 03, 2013 9:31 pm
by Simon
Great,
Thank you for taking the time to communicate.
If it were me I wouldn't be printing the DG it self (because of the scrolling flds) but export the information to a new card for printing. I think if you figure out how to format the first row of the DG then you just have to loop through the others.
probably something like (pseudo code):
repeat for i = 1 to the number of rows in DG 1
create group ("row" & i)
start editing group ("row" & i)
--Do your image and text importing here size/location
stop editing group ("row" & i)
set the width of group ("row" & i) to 400 -- whatever you like
set the height of group ("row" & i) to the formattedHeight of group ("row" & i)
if i = 1 then
set the topLeft of group "row1" to the topLeft of this cd
else
set the topLeft of group ("row" & i) to the bottomLeft of group ("row" & i -1)
end if
end repeat
Don't know how many records you have, probably break down the number of loops.
Simon
Re: Printing formatted images/text
Posted: Thu Apr 04, 2013 7:20 am
by Traxgeek
Simon, Thanks - fantastic.
I had failed, until this thread - and your explanations, to grasp the principles.
It appears to me that, in effect, one creates a 'pre-Print' card (say, crdPrePrint), puts ones data onto it, formats it all and, when all visually 'perfect' runs a 'print card 'crdPrePrint' ' statement... and then battles with any formatting issues that may arise from any printer / screen control / format issues...
I had, incorrectly, assumed I could simply print using 'print - at' statement blocks and then failed to locate more detailed info.
Creating a hidden (or not) card, on which to create my 'report' (print info), makes great sense to me and would at first glance - it's a new day here! - appear to be far more controllable in that one can see the layout on a (prePrint) card before actually committing to spewing ink onto paper and then throwing it all in the bin numerous times until one ends up with the desired layout...
Great stuff. <b>IF</b> I've gotten the above correct then I am starting to understand the principles behind printing great 'reports'. Love it.
I'm off to 'play'. I'll update this thread with my successes.
Thanks a million.
Regards.
Re: Printing formatted images/text
Posted: Thu Apr 04, 2013 7:47 am
by Simon
Glad it helped!
I forgot to mention the hidden card. Margins are a pain, I did waste paper on that the first time.
Hey, right now I don't know how you would set up when the groups roll over to a new page, maybe you could tell me?
assumed I could simply print using 'print - at' statement
There should be an acronym for It Might Not Be The Best Way... because I'd use it all the time.
maybe The Way I'd Do It... TWIDT... Code Realized Absolute Piffle
Simon
Re: Printing formatted images/text
Posted: Thu Apr 04, 2013 8:47 am
by Nakia
I also went through this a while back (but printing to PDF) and I ended up
using a printTemplate stack as Simon suggested.
The only oddity I found doing this was having to remember to open the stack before issuing th e
Print command and then closing when done..
Re: Printing formatted images/text
Posted: Fri Apr 05, 2013 7:32 am
by Traxgeek
Thanks again Simon,
I'll certainly need to 'rollover' a page (add some kind of PageBreak code) so I'll revert in the very near future with some ideas / code as to how I manage that.
Oh, and thanks for the margins tip...

Appreciated.
Re: Printing formatted images/text
Posted: Fri Apr 05, 2013 7:34 am
by Traxgeek
Aha - Thanks Nakia. I was going to look at the PrintToPDF as some stage so... I'll remember your open/close Stack tip...
Again, much appreciated.
Have a great weekend both.
Regards.