arcgis engine 输出pdf文档大小不正确 pdf数据比例尺不正确问题?

//设置文档大小
IPageLayout ipageLayout = m_PageLayoutControl.PageLayout;
IPage page = ipageLayout.Page;
ipageLayout.AlignToMargins = false;
page.Units = esriUnits.esriCentimeters;
page.PutCustomSize(80, 70);
//数据框比例尺设置为10000
IGraphicsContainer pGraphicsContainer = m_PageLayoutControl.GraphicsContainer;
IMapFrame pMapFrame = pGraphicsContainer.FindFrame(m_PageLayoutControl.ActiveView.FocusMap) as IMapFrame;
pMapFrame.MapScale =10000;
m_PageLayoutControl.Refresh(esriViewDrawPhase.esriViewAll, null, null);
//输出pdf
private void ExportData()
{

try
{
m_ActiveView = m_PageLayoutControl.ActiveView;
IEnvelope pPixelBoundsEnv;
int iOutputResolution;
int iScreenResolution;
int hDC;
//由于输出分辨率不同于屏幕分辨率,所以需要设置两个值用于尺寸计算
iScreenResolution = 96;
iOutputResolution = 300;
tagRECT pExportFrame;
pExportFrame = m_ActiveView.ExportFrame;
tagRECT exportRECT;
exportRECT.left = 0;
exportRECT.top = 0;
exportRECT.right = m_ActiveView.ExportFrame.right * (iOutputResolution / iScreenResolution);
exportRECT.bottom = m_ActiveView.ExportFrame.bottom * (iOutputResolution / iScreenResolution);
//使用pPixelBoundsEnv来设置输出范围
pPixelBoundsEnv = new EnvelopeClass();
pPixelBoundsEnv.PutCoords(exportRECT.left, exportRECT.top, exportRECT.right, exportRECT.bottom);
IExportFileDialog pExportDialog;
pExportDialog = new ExportFileDialogClass();
pExportDialog.DocumentName = GetMapTitle();//读取xml文件获取 地图名称
bool pBool;
pBool = pExportDialog.DoModal(pPixelBoundsEnv, m_ActiveView.Extent, m_ActiveView.Extent, 300);//最后要不是300 导出的地图范围出错
string prjPath="";

if (pBool)
{
m_Export = pExportDialog.Export;
prjPath =m_Export.Filter;
m_Export.Resolution = iOutputResolution;
m_Export.PixelBounds = pPixelBoundsEnv; //必须重新赋值 否则在输出 jpg 和tif的时候会出问题
hDC = m_Export.StartExporting();
ITrackCancel pCancle = new CancelTrackerClass();
m_ActiveView.Output(hDC, (int)m_Export.Resolution, ref exportRECT, null, null);
m_Export.FinishExporting();
m_Export.Cleanup();
}
else
return;

}
catch (Exception ex)
{

return;
}

}
已邀请:

要回复问题请先登录注册