我在Revit API PrintManager属性(特别是在PrintToFileName属性和错误中出现问题:Invalid fileName。
在打印为pdf时声明要为打印视图命名的正确方法是什么?
我的来源(将日程表放到空白纸上并打印):
ViewSheet sheet = ViewSheet.Create(Doc, ElementId.InvalidElementId);
Element view = new FilteredElementCollector(Doc)
.OfClass(typeof(ViewSchedule))
.Where(o => o.Name == element) //element is a string from a list of items in a WPF listbox.
.First();
ScheduleSheetInstance.Create(Doc, sheet.Id, view.Id, XYZ.Zero);
ViewSet set = new ViewSet();
set.Insert(sheet);
IList<ElementId> print = new List<ElementId>();
print.Add(sheet.Id);
Uidoc.Selection.SetElementIds(print);
printManager.PrintRange = PrintRange.Select;
ViewSheetSetting viewSheetSetting = printManager.ViewSheetSetting;
viewSheetSetting.CurrentViewSheetSet.Views = set;
printManager.SelectNewPrintDriver("Adobe PDF");
printManager.PrintToFile = true;
printManager.CombinedFile = true;
printManager.PrintToFileName = "TestFileName"; //ERROR HERE
printManager.Apply();
printManager.SubmitPrint(sheet);
也许您需要输入文件的完整路径和名称。