Printing Troubles -- Will they ever end???

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

egolombek
Posts: 74
Joined: Thu Jan 30, 2020 2:11 pm

Printing Troubles -- Will they ever end???

Post by egolombek » Tue Aug 11, 2020 10:26 am

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???

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 11:11 am

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)
Attachments
bog.livecode.zip
Here's the stack.
(208.33 KiB) Downloaded 145 times

egolombek
Posts: 74
Joined: Thu Jan 30, 2020 2:11 pm

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

Post by egolombek » Tue Aug 11, 2020 11:43 am

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 12:39 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 1:06 pm

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.
Attachments
bigFatTest.pdf.zip
Here's the PDF from the stack
(17.48 KiB) Downloaded 175 times
Last edited by richmond62 on Tue Aug 11, 2020 2:51 pm, edited 1 time in total.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 1:10 pm

How did I work that out?

Looked in the built-in Documentation . . .

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

egolombek
Posts: 74
Joined: Thu Jan 30, 2020 2:11 pm

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

Post by egolombek » Tue Aug 11, 2020 2:07 pm

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.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 2:12 pm

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%

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 2:50 pm

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.
Attachments
bigFatTest.pdf.zip
PDF produced by stack
(11.05 KiB) Downloaded 175 times
Hairy Knees.livecode.zip
Here we go again.
(1.12 KiB) Downloaded 129 times

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 3:22 pm

I built a Macintosh standalone which printed-to-PDF a perfectly respectable PDF

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9823
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

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

Post by FourthWorld » Tue Aug 11, 2020 4:04 pm

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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Tue Aug 11, 2020 5:47 pm

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

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 9359
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria

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

Post by richmond62 » Tue Aug 11, 2020 7:33 pm

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?
Last edited by richmond62 on Tue Aug 11, 2020 8:45 pm, edited 1 time in total.

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

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

Post by SparkOut » Tue Aug 11, 2020 7:47 pm

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.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9648
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

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

Post by dunbarx » Tue Aug 11, 2020 7:54 pm

Richmond.

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

Craig

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”