Create, be able to print then save a pdf...

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
TodayIsTheDay
Posts: 56
Joined: Sat Jun 20, 2009 2:41 pm

Create, be able to print then save a pdf...

Post by TodayIsTheDay » Wed Oct 14, 2009 7:10 pm

Looking at the pdf library but not even sure where to start.

I need to be able to print a card to an 8 1/2 x 11 sheet of paper (and save that pdf, preferably automatically)

The screen is not laid out the same each time. (The position of text boxes may change, etc.)

Is it possible to get the current layout / position and contents of the fields, write that to a pdf, open it and save it. ( I would prefer it to be saved in a folder automatically)

The #1 goal is printing, the #2 goal is saving a copy.

Thanks.

TodayIsTheDay
Posts: 56
Joined: Sat Jun 20, 2009 2:41 pm

Post by TodayIsTheDay » Fri Oct 16, 2009 12:46 am

Has anyone done any work with the pdf plugin that can offer some advice? Anyone please?

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

Post by Janschenkel » Fri Oct 16, 2009 6:50 am

Hi There,

There is unfortunately no magic 'print this card' command in the library. That's partially because not all of the necessary parts are there (clipping and unicode come to mind) but also because of the inherent complexity of the task: rev controls can have a dazzling combination of properties, some of which even have platform-specific side effects.

That being said, you most certainly can make 'dynamic' layouts by scripting your 'report rendering' process flexibly. Just a few hints:
  • in the qrtPDF_CreateDocument function, one of the parameters is the document unit (points, millimeters, centimeters, inches) ; a 'point' is roughly the same as a pixel on screen so using that unit will save you from having to do a unit conversion
    -> there are also unit conversion functions if you want to mix different approaches
  • by using the qrtPDF_GetXY function and the qrtPDF_SetXY command, you can remember positions and jump reltive distances from the current XY text coordinate
  • building a full-blown layout builder for end-users is not exactly an easy job but converting a 'layout' stack into a 'rendering' script is certainly achievable and can be simplified by applying conventions and not getting over-ambitious in the special effects department
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply