Previous Document Next Document

Understanding the CorelDRAW object model : Working with documents : Publishing documents to PDF


Publishing documents to PDF

Publishing documents to PDF is a two-step process. The first step is to specify the PDF settings (although this step can be skipped by specifying those settings from the application or by using the default settings). The second step is to export the file.

To specify the PDF settings, you can use the Document.PDFSettings property. This property is an object of type PDFVBASettings and contains properties for all PDF settings that can be set in the Publish To PDF dialog box.

The following VBA code exports pages 2, 3, and 5 to a PDF file named MyPDF.pdf:

Dim doc As Document
Set doc = ActiveDocument
With doc.PDFSettings
.Author = "Corel Corporation"
.Bookmarks = True
.ColorMode = pdfRGB
.ComplexFillsAsBitmaps = False
.CompressText = True
.DownsampleGray = True
.EmbedBaseFonts = True
.EmbedFonts = True
.Hyperlinks = True
.Keywords = "Test, Example, Corel, CorelDRAW, PublishToPDF"
.Linearize = True
.PageRange = "2-3, 5"
.pdfVersion = pdfVersion13
.PublishRange = pdfPageRange
.TrueTypeToType1 = True
End With
doc.PublishToPDF "C:\MyPDF.pdf"

The following VBA example gives more control to the user by displaying the Publish to PDF Settings dialog box:

Dim doc As Document
Set doc = ActiveDocument
If doc.PDFSettings.ShowDialog = True Then
doc.PublishToPDF "C:\MyPDF.pdf"
End If

 
Profiles for PDF settings can be saved and loaded by using the PDFVBASettings.Save method and PDFVBASettings.Load method (respectively).

Previous Document Next Document Back to Top

Copyright 2013 Corel Corporation. All rights reserved.