image ResEx Logo
ResExcellence www : Powered by Google
Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Articles
   3D
   Audio
   Custom Controls
   General RB
   Graphics
   Hacks
   Mac OS X
   Menus
   Novelty
   Printing
   REALbasic 2005
   REALbasic 2006
   Registration
   Resources
   Reviews
   Serial
   Speech
   Sockets
   XML
   Video
Resource Links
News
   Current News
   February 2006
   January 2006
   December 2005
   November 2005
   October 2005
   September 2005
   August 2005
   July 2005
   June 2005
   May 2005
   April 2005
   March 2005









REALbasic for Dummies
by Erick Tejkowski


Learning REALbasic through Applications
by Clayton E., Crooks II


REALbasic for Macintosh
by Michael Swaine


REALbasic Cross-Platform Application Development
by Mark S. Choate





Older files are in Stuffit 5 or greater format. Newer files are ".Zip". Download StuffIt Expander
Tell us about a bad link. Thank You!

Print to PDF With REALbasic by Erick Tejkowsi
11-07-02

Printer Version




By now, you probably know that PDF is a very important part of Mac OS X. It can create and display PDF without any extra software. Did you know that you can create your own PDF documents using standard REALbasic code? If not, join us today as we take a look at how to do it.

Build the Interface
Today's example project is very simple to build. All you'll need is one PushButton. Launch REALbasic and add one PushButton to Window1. Resize the window to your preferences. My example interface looks like this:

11-07-02_interface.jpg (13k)

That's it! That wasn't so tough, now was it?

Add the Code
The code for this project is also very easy to complete. In fact, you don't have to type one bit of code if that's your preference. Double click the PushButton in Window1. Then, press Cmd-1 (one) to open the Language Reference. Navigate to the Printersetup class. Once you find it, scroll down to the bottom of its documentation. The third snippet of code in the Exmamples section is what you need.

11-07-02_helpdocs.jpg (41k)

As you can see, the code is outlined with a square. Drag that square to the Action event of the PushButton in the Code Editor.

That's all there is! To test your code, select the Debug-Run menu. Click the PushButton. You'll immediately see a Page Setup dialog. Adjust it to you liking and click OK.

11-07-02_pgsetup.jpg (42k)

Next, you'll see the standard Print dialog. Notice the "Save as PDF" button at the bottom of this window. That's the one you want to click.

11-07-02_print2pdf.jpg (23k)

When you click the "Save as PDF" button, you'll see the standard Save dialog. The new document that you "print" can be opened with your favorite PDF viewer like Preview or Adobe Acrobat.

Conclusion
If you don't feel like recreating this project, you can download it here. See you next week!




Cell Phone Themes Icons Mighty Mouse Cursors Software Reviews Widgets & Widgets

Maintained by the Staff of ResExcellence. This entire site ©1997-2006 ResExcellence
Privacy Statement? Sure we gotta Privacy Statement. [an error occurred while processing this directive]