原創|使用教程|編輯:郝浩|2013-05-14 14:10:42.000|閱讀 279 次
概述:本文列舉了VectorDraw Developer Framework的兩種PDF多頁打印技巧
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
CAD繪圖控件 VectorDraw Developer Framework 從6.11版開始在PrinterRender對象中新增了一個方法:ExportMultiPagePDF,這個方法可以輸出多頁PDF文件。下面跟大家列舉兩種多頁打印PDF的應用技巧。
1、下面這個示例演示輸出PDF文件單獨頁面的所有布局:
int numprinters = vdFramedControl.BaseControl.ActiveDocument.LayOuts.Count + 1; vdPrint []printers = new vdPrint[numprinters]; int i = 0; printers[i] = vdFramedControl.BaseControl.ActiveDocument.Model.Printer; printers[i].PrintExtents(); printers[i].PrintScaleToFit(); i++; foreach (vdLayout layout in vdFramedControl.BaseControl.ActiveDocument.LayOuts) { printers[i] = layout.Printer; i++; } VectorDraw.Render.PrinterRender.ExportMultiPagePDF(new RenderFormats.PdfRender(), vdFramedControl.BaseControl.ActiveDocument, printers, @"C:\Documents and Settings\Administrator\Desktop\test.pdf");
2、如果你的繪圖沒有布局,只有模型,想把多個PDF頁面中的模型打印出來,那請參考下面的代碼:
int numprinters = 2; //two pages = two regions VectorDraw.Professional.vdObjects.vdPrint[] printers = new VectorDraw.Professional.vdObjects.vdPrint[numprinters]; int i = 0; //set the first printer settings and printable area printers[i] = new VectorDraw.Professional.vdObjects.vdPrint(vdFramedC.BaseControl.ActiveDocument.Model.Printer); printers[i].PrintWindow = new VectorDraw.Geometry.Box(new VectorDraw.Geometry.gPoint(-2, -1), new VectorDraw.Geometry.gPoint(866, 1122)); printers[i].PrintScaleToFit(); //set the second printer settings and printable area i++; printers[i] = new VectorDraw.Professional.vdObjects.vdPrint(vdFramedC.BaseControl.ActiveDocument.Model.Printer); printers[i].PrintWindow = new VectorDraw.Geometry.Box(new VectorDraw.Geometry.gPoint(-2, -1458), new VectorDraw.Geometry.gPoint(866, -330)); printers[i].PrintScaleToFit(); //Export to PDF VectorDraw.Render.PrinterRender.ExportMultiPagePDF(new RenderFormats.PdfRender(), vdFramedC.BaseControl.ActiveDocument, printers, @"C:\testing\test1.pdf");
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉載自:慧都控件