HOW TO
Instructions provided demonstrate how to programmatically embed fonts when exporting a map to PDF format.
Note:
Code in the Project's ThisDocument code module will only run in the current map document. To store the code in all map documents open the Normal.mxt ThisDocument code module instead.
Code:
Sub exportPDF()
Dim pMxApp As IMxApplication
Dim pMxDoc As IMxDocument
Dim pActiveView As IActiveView
Dim pPageLayout As IPageLayout
Dim pExporter As IExport
Dim pExporter2 As IExportPDF
Dim pPrinter As IPrinter
Dim pRECT As tagRECT
Dim hDc As OLE_HANDLE
Dim pDriverBounds As IEnvelope
Dim pVisibleBounds As IEnvelope
Dim pPixelBounds As IEnvelope
Dim ipPixelBounds As IEnvelope
Dim width As Double
Dim height As Double
Set pMxApp = Application
Set pMxDoc = ThisDocument
Set pActiveView = pMxDoc.ActiveView
Set pPageLayout = pMxDoc.PageLayout
Set pExporter2 = New exportPDF
Set pExporter = pExporter2
Set pPrinter = pMxApp.Printer
Set pVisibleBounds = New Envelope
Set pVisibleBounds = Nothing 'set to nothing unless clip to graphic extent is checked
Set pPixelBounds = New Envelope
pExporter.ExportFileName = "C:\temp\PDFexport.pdf"
pExporter.Resolution = 300
pExporter2.EmbedFonts = True
pPrinter.QueryPaperSize width, height
pRECT.Left = 0
pRECT.Top = 0
pRECT.Right = width * pExporter.Resolution
pRECT.bottom = height * pExporter.Resolution
pPixelBounds.PutCoords pRECT.Left, pRECT.Top, pRECT.Right, pRECT.bottom
pExporter.PixelBounds = pPixelBounds
hDc = pExporter.StartExporting
pMxDoc.ActiveView.Output hDc, pExporter.Resolution, pRECT, pVisibleBounds, Nothing
pExporter.FinishExporting
End Sub
Article ID:000007500
Get help from ArcGIS experts
Download the Esri Support App