|
|
| GeoCommunity Mailing List |
| |
| Mailing List Archives |
| Subject: | [gislist]: arcobjects and exporting a layout in pdf |
| Date: |
06/29/2004 09:15:01 AM |
| From: |
Luigi Maiorano |
|
|
Dear list members
I am trying to write a arcobjects macro for exporting a layout to a pdf = file. My code is able to export the map into pdf but I have two = problems:=20 1) it does not use the resolution that I am specifying and=20 2) it is producing the pdf file in a page format really strange
I want the code to produce a 300dpi pdf file placed in a A3 page. If I = produce the map "by hand" (I mean doing the process by hand using the = file>export map menu) I get a really beautiful file (that fits an A3 = page format and has a resolution of 300 dpi). If I have the macro = running I produce a file that has the dimensions of 94.9 x 134.4 = millimeters and a much lower resolution. I have no idea of how to solve = this problem. I have tried also setting a printer with the default page = size A3 so this should not be a problem. And naturally the page setup in = the layout view that I am testing is saved on the A3 format.
the following code is my macro:
Public Sub exp_pdf(pNameLSp As String)
Dim pMxDoc As IMxDocument Dim pActiveView As IActiveView Dim pExporter As IExporter Dim pEnv As IEnvelope Dim exportFrame As tagRECT Dim dpi As Integer Dim xMin As Double Dim yMin As Double Dim xMax As Double Dim yMax As Double Dim HDC As Long
Set pMxDoc =3D Application.Document Set pActiveView =3D pMxDoc.PageLayout Set pExporter =3D New PDFExporter 'JpegExporter Set pEnv =3D New Envelope
'Setup the exporter exportFrame =3D pActiveView.exportFrame pEnv.PutCoords exportFrame.Left, exportFrame.Top, exportFrame.Right, exportFrame.bottom dpi =3D 300 'set a higher resolution
With pExporter .PixelBounds =3D pEnv .ExportFileName =3D "C:datiangkokmodelli" & pNameLSp & ".pdf" .Resolution =3D dpi End With
'Recalc the export frame to handle the increased number of pixels Set pEnv =3D pExporter.PixelBounds pEnv.QueryCoords xMin, yMin, xMax, yMax exportFrame.Left =3D xMin exportFrame.Top =3D yMin exportFrame.Right =3D xMax exportFrame.bottom =3D yMax
'Do the export HDC =3D pExporter.StartExporting pActiveView.Output HDC, dpi, exportFrame, Nothing, Nothing pExporter.FinishExporting
End Sub
Thanks for your help (I will sum up)
Luigi
------------------------------------------------- Luigi Maiorano Dept of Fish and Wildlife College of Natural Resources University of Idaho, USA 83843 Moscow (USA)
and
Dip. Biologia Animale e dell'Uomo Universit=E0 di Roma "La Sapienza" c/o IEA (Istituto di Ecologia Applicata) via L. Spallanzani 32 00161 Roma
Tel. +39.06.4403315 Fax. +39.06.4403315 Mob. +39.349.1247415
e-mail: maio1323@uidaho.edu
-------------------------------------------------
_______________________________________________ gislist mailing list gislist@lists.geocomm.com http://lists.geocomm.com/mailman/listinfo/gislist
_________________________________ This list is brought to you by The GeoCommunity http://www.geocomm.com/
Get Access to the latest GIS & Geospatial Industry RFPs and bids http://www.geobids.com
|
|

Sponsored by:

For information regarding advertising rates Click Here!
|