Rev for PDF printing?

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
activa
Posts: 5
Joined: Tue Nov 20, 2007 10:48 pm

Rev for PDF printing?

Post by activa » Wed Nov 21, 2007 1:38 pm

I've got a client who wants a simple product: a CD with PDFs, and a front end to print them. I'm sure I can do it with Rev, but is it the best tool? Can I do it directly from Acrobat directly? (I have v8 pro) If I do it from Rev, do I have to use rev to open Acrobat and then print?

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Wed Nov 21, 2007 9:14 pm

Hi Activa,

While Revolution can't do it natively, you can combine it with other tools to achieve the goal.

For Windows you can use "pdfp" - a command-line tool to print PDF files - as long as there's an Acrobat Reader installed on the client computer.
You can download the pdfp.zip package (including C source code) here: http://www.esnips.com/doc/9e2a3a72-52ca ... 5f02f/pdfp
Then you can execute a silent shell command to print the PDF file:

Code: Select all

on mouseUp
  answer file "Select a PDF file to print"
  if it is empty then exit mouseUp
  put revWindowsFromUnixPath(it) into tFilePath
  put "pdfp.exe" && tFilePath into tCommand
  put the hideConsoleWindows into tSaveHCW
  set the hideConsoleWindows to true
  get shell(tCommand)
  set the hideConsoleWindows to tSaveHCW
end mouseUp
On Mac, you can use AppleScript to tell the Finder to print the PDF file:

Code: Select all

on mouseUp
  answer file "Select a PDF file to print"
  if it is empty then exit mouseUp
  put revMacFromWindowsPath(it) into tFilePath
  put "tell application" && quote & "Finder" & quote && \
      "to print file" && quote & tFilePath & quote \
      into tCommand
  do tCommand as AppleScript
end mouseUp
Turning the above into a general-purpose cross-platform handler is left as an exercise to the reader :-)

Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Post by BvG » Thu Nov 22, 2007 6:12 pm

For windows there's also the open source pdf creator. It installs a software printer, which you can talk to like a normal printer.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Post Reply

Return to “Talking LiveCode”