Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 18.6 ('Git')
Instant purchase and download via GumRoad!



Issue: 18.6 (November/December 2020)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 29,119
Starting Page Number: 85
Article Number: 18607
Resource File(s):

Download Icon project18607.zip Updated: 2020-11-02 09:51:31

Related Web Link(s):


Excerpt of article text...

One of the most exciting new features of Xojo 2020r1 for me is the built-in support for creating PDFs. If you aren't familiar with it, it basically lets you draw a PDF using standard graphics command (drawFilledRectangle, drawLine, drawText, etc.).

Note that I've only just started to play with the new class, so this article is a mere introduction. But it should give you an overview and the included demo app will give you a testing ground to explore the feature.

PDF Basics

Xojo 2020r1 introduces a new class, PDFDocument, which is used to generate PDFs. On the surface this class is pretty simple. There really aren't many methods or properties at all (https://docs.xojo.com/PDFDocument).

That is deceptive, however, because there are several parts to the system. For instance, all drawing of the PDF is done via its graphics object. This looks and works similar to the graphics object of a picture. In theory, you can use your same picture-drawing code only send it to a PDFDocument.graphics object. In practice, as I'll explain, things aren't quite so copacetic.

Other PDFDocument commands include a method to add fonts to the PDF, save the PDF to a file, and even create a PDF via JSON data. I won't really get into those items in this article, but they are worth exploring in the future.

...End of Excerpt. Please purchase the magazine to read the full article.