| Barry MacDonnell's
Toolbox for WordPerfect
Macros, tips, and
templates for Corel® WordPerfect® for Windows®
| Page updated Mar 28, 2019
| SaveAsPDF - A macro to automate saving the current document as a PDF file to any drive or folder
Related pages -
• Publishing to PDF with WordPerfect 9 and later versions (tips on the feature and some simple macros)
| Purpose and operation
When you have more than a few PDF files to create from WordPerfect documents, SaveAsPDF.wcm can help automate the task.
Note that it uses WordPerfect's own File > Publish to PDF feature to create and save the current on-screen document as a PDF file -- but unlike the standard Publish to PDF feature it can automatically save the PDF to a specific dedicated drive and folder.
The specific PDF location can be easily changed, even when the macro plays (via a pop up menu).
This can be useful if you want to quickly convert several open documents to PDFs and store them in a specific location rather than in the current document's disk location, which is the WordPerfect default.
Just play it in any open document and a dialog menu will appear to let you verify and optionally change the target folder and (if desired) the name of the PDF file. Click OK and the job is done.
Your preferred default folder for the PDF file can be specified (i.e., made relatively static) in the macro's User Modification Area at the top of the macro code by simply changing the value of a single variable (vPDFLocation) to a specific drive and path. Simply open the macro like any document to edit it, and follow the instructions in the Modification area.
This should help when you frequently need to create PDFs and place them in a specific location, even on a network drive. (In contrast, the program's Publish to PDF feature always uses the same folder as the currently open WPD file.)
The default PDF filename used by the macro is the same name as the existing WPD's name. The macro will add a .pdf filename extension to the PDF name at run time. However, you can always change the PDF's root file name from the macro's menu.
Tip: If you often need to use several specific folders to store your PDFs, you could make several copies of this macro (named slightly differently and with different default folders specified at the top of the macro code) and add them to your menu, main toolbar (or a custom toolbar) or even to a dedicated macro menu. See here for links to these topics.
WordPerfect's Publish to PDF feature displays a dialog ("Publish to PDF") with options on it. Further, it has a Settings button on the dialog. This button brings up another dialog ("Publish to PDF Settings"). On that dialog's General tab you can (e.g.) choose between Full Document, Current Page, a Selection of text, or a particular group of pages. Other tabs on that "Publish to PDF Settings" dialog have more options (most users typically accept the factory default settings).
It is important to note that the choices you make on the main "Publish to PDF" and the "Publish to PDF Settings" dialogs in WordPerfect are "sticky" between WordPerfect sessions.
Hence the SaveAsPDF macro will use the program's last-saved settings for the Publish to PDF feature when it creates and saves the current document as a PDF file. (There's a small reminder to verify the Publish to PDF settings on the macro's pop up menu.)
For most users this should not be an issue. But (e.g.) this sometimes becomes a problem if changes were made to the Publish to PDF dialog or its Settings. (Any changes can "stick" until they are changed again.) Here are two examples:
If you always want the PDF to immediately open in your PDF reader as soon as it is created, the checkbox "Open PDF After Saving" at the bottom of the Publish to PDF dialog should be enabled (ticked). If it not enabled the PDF will be created ... but it won't be automatically opened.
If you have chosen something other than Full Document with the Settings button (e.g., Current Page) your new choice becomes the default for future sessions, and can cause concern if you might be expecting the standard default of Full Document. Just bring up the Publish to PDF feature from the program's File menu and click the Settings button to verify the current settings and options.
See more on this issue and other PDF tips here.