Quartam PDF Library - Examples

Home | Products | Services | Resources | Store | Company | Terms of Use | Privacy Policy | Site Map

Copyright 2004-2013, Quartam Software/Jan Schenkel. All Rights Reserved Worldwide.

Quartam is a trademark of Jan Schenkel. Other names may be trademarks or registered trademarks of their respective owners.

Quartam PDF Library enables LiveCode developers to create PDF documents by script - you create a document; add pages; draw graphics, images and text; finally output the PDF data to a file; and then free up the memory. Below is a simple 'Hello, world!' example to illustrate the basic workflow :

on mouseUp
ask file "Save as:" with "demo1.pdf"
if it is empty then exit mouseUp
put it into tFilePath
-- create a new PDF document with default
-- > units = millimeters
-- > page size = A4
-- > orientation = portrait
-- save the document reference for later library calls,
-- then open the document and add an empty page
put qrtPDF_CreateDocument() into tDocRef
qrtPDF_OpenDocument tDocRef
qrtPDF_CreatePage tDocRef
-- set the current text style with
-- > textfont = Arial
-- > textstyle = bold
-- > textheight = 18
qrtPDF_SetFont tDocRef, "Arial", "bold", 18
-- write the text in an invisibe box
-- > starting at 40mm from the left edge of the paper, and 10mm from the top
qrtPDF_WriteTextBox tDocRef, 40, 10, "Hello, world!"
-- close the document, save it to a file and remove its data from memory
qrtPDF_CloseDocument tDocRef
qrtPDF_SaveDocument tDocRef, tFilePath
qrtPDF_DeleteDocument tDocRef
end mouseUp

With automatic page breaks and callbacks to let you draw page headers and footers, you have all the power at your fingertips to create PDF documents from your LiveCode-based applications.

Make sure to visit the gallery and download the demo version to explore the example scripts.