Custom printing tool not working in Revit 2014

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
I created a fairly simple batch printing tool that works fine in Revit 2013 but crashes in 2014 after printing with an "An unrecoverable error has occured..." message box.
This is the relevant code (part of a larger class):
PrintManager printManager = doc.PrintManager;
printManager.PrintRange = PrintRange.Select;
printManager.ViewSheetSetting.SaveAs(Guid.NewGuid().ToString());
printManager.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType = ZoomType.FitToPage;
printManager.SelectNewPrintDriver(_driverName); // _driverName is a string property
printManager.PrintToFile = true;
foreach (WinForms.DataGridViewRow row in form.dgvSheets.SelectedRows)
{
PrintSheet ps = row.DataBoundItem as PrintSheet; // PrintSheet is a class that wraps ViewSheet
ViewSheet vs = ps.AssociatedSheet;
printManager.PrintToFileName = Path.Combine(Destination, ps.NewFileName);
if (File.Exists(printManager.PrintToFileName))
{
if (Overwrite)
File.Delete(printManager.PrintToFileName);
else
continue;
}
printManager.Apply();
bool ok = printManager.SubmitPrint(vs);
}
Any ideas?