Page 1 of 2

Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 10:26 am
by egolombek
I have returned to the problem of printing. I have spent too many hours on various alternate solutions and I am super frustrated. Maybe someone here can help.

Here's what I do... I need to print a page with all sorts of data arranged in a particular way. To do this, I created a separate stack which I open invisibly and populate. Because the program crashed every time it encountered Hebrew (which comes up in my work), I take a snapshot of the page, and then print the page, before moving to the next record. Some of the code:
open printing to pdf tPDFPath
set the paintCompression to "PNG"
import snapshot from rectangle (the rect of this card) of this card
print this card into 0,0,575,780
print break
delete the last image

All of this works perfectly until I compile as a standalone. At that point, it doesn't work. Meaning what? That I am missing an inclusion? I wish that in the dictionary it said... this function requires this library... it seems to obvious to include that rather than guessing what is needed. Anyway, any thoughts?

Did I mention I am super frustrated???

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 11:11 am
by richmond62
You seem to be printing to PDF . . .

If you do NOT require embedded text in your PDF why don't you "just" export the card to an image?

Code: Select all

on mouseUp
   ask file "Choose where you wish to save your image"if the result = "cancel" 
   then exit mouseUp
   else
      export snapshot from card "EHAD" to file it & ".png" as PNG
      set the itemDelimiter to slash
      set the defaultFolder to item 1 to -2 of the longFilePath of it
   end if
end mouseUp

[quote]Did I mention I am super frustrated???[/quote]

Sorry: lost focus there: been away making bookshelves.  8)

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 11:43 am
by egolombek
Thanks, for the idea but I don't think it will work as a work-around. The goal is to make a 30 page pdf. Each page is a different record (student). I don't think a graphic really fits the bill. But the more I play around with it, it seems that the pdf maker in LiveCode is buggy to the point of being unusable. I may have to try printing where the user can choose to print to a pdf. Not that I am confident that will work either.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 12:39 pm
by richmond62
The revPrintField thing has worked for at least 7 years on Macintosh, and, supposedly,
now works cross-platform although I haven't had time to play with it recently.

That can spit out a decent PDF.

HOWEVER: if I read you correctly (?) you wish to print out a multi-page PDF of cards containing textFields
that contain embedded text
.

The italicised bit might be expecting too much.

If you try this:

Code: Select all

put it & card "EHAD" & ".pdf" into target_file/code]

you will get a "source is not a container" message as that code is looking for a field.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 1:06 pm
by richmond62
Well, this works on macOS 11.0 beta 1 in LC 9.6.1 RC 2 . . .

Saves the PDF in your default folder.

Code: Select all

on mouseUp
   open printing to pdf "bigFatTest.pdf"
   print card "EHAD"
   close printing
end mouseUp
-
Screenshot 2020-08-11 at 15.03.04.png
-
You may go bonkers at the simplicity of the thing. 8)

Stack removed as improved version uploaded subsequently.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 1:10 pm
by richmond62
How did I work that out?

Looked in the built-in Documentation . . .

Make the Documentation your home-from-home. :)

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 2:07 pm
by egolombek
I appreciate your assumption that since this is a forum for absolute beginners, that I did not try that. But, I have used the simple print to pdf for months now. The problem is that the performance is inconsistent in the extreme:

- prints one page, but stops when it hits Hebrew for the first time (inexplicably)
- prints all the pages, but leaves out some fields
- works perfectly in developer mode, but then does not work as a standalone (the current problem I a facing)
- works when the stack is visible, but not when open and invisible
- works if the scaling factor of the stack is set to the size of the printRectangle, but then stops after one card

etc.. These are some of the problems I have had with print to pdf. In other words, it is basically a disaster.

The point on documentation is that there are certain inclusions that you need to include when building a standalone, but who knows what they are? Some are obvious from the name, and others I have no idea what they are. Why not say next to each function or command if it requires a library to be included when compiled? It really seems like a major fault in the documentation.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 2:12 pm
by richmond62
Why not say next to each function or command if it requires a library to be included when compiled? It really seems like a major fault in the documentation.
I agree with you 100%

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 2:50 pm
by richmond62
However . . .

Having "upgraded" my stack to a 2 card stack (cutting edge, this stuff) and popping this into the button:

Code: Select all

on mouseUp
   open printing to pdf "bigFatTest.pdf"
      print card "EHAD"
      print card "SHTEIM"
   close printing
end mouseUp
The stack merrily popped out a perfectly respectable 2 page PDF with everything intact.

Come to think of things, I don't think you mentioned what operating system you are using.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 3:22 pm
by richmond62
I built a Macintosh standalone which printed-to-PDF a perfectly respectable PDF

inside the app package (which is a bit potty).

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 4:04 pm
by FourthWorld
LC defaults to discovering needed inclusions and setting those for you, but if you've turned that off to choose the manual option instead for printing to PDF you'll want to include the "PDF Printer" external in the Standalone Builder's "Inclusions" pane.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 5:47 pm
by dunbarx
Richard is almost certainly correct, since you can print from the IDE. but cannot from a standalone. The standalone needs the inclusion.

In the dictionary, not that it is particularly prominent, is this:
Important: The implementation of pdf printing resides in a dynamic library called revpdfprinter. The standalone builder will automatically include this in the appropriate place when building standalones.
If that is any consolation.

Craig

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 7:33 pm
by richmond62
I built a Macintosh standalone
What a slob: I didn't even pause at the inclusionas card. :?

Why?

Because . . . building for macOS only on macOS the bloody icon at the top was deactivated . . . :evil:

OK: trying a "crozz-platform horror" . . .

Nope; inclusions icon is non-functional (community).

Oh, Holy Baloney; inclusions icon is non-functional (indy).

So, what's "all this" about inclusions in standalones if that doesn't even work for a stack that 'wants' to print to PDF?

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 7:47 pm
by SparkOut
You have to choose the auto or manual choice of inclusions option on the General tab, that toggles the disabled state of the inclusions tab.

Re: Printing Troubles -- Will they ever end???

Posted: Tue Aug 11, 2020 7:54 pm
by dunbarx
Richmond.

The inclusions icon is disabled if you check "Search for required Inclusions..." in the "General" pane.

Craig