autodesk-forgeautodesk-viewerrevit-apiautodesk-designautomationautodesk-construction-cloud

Revit floorplan view PDF print using Design Automation API


I developed a Revit plugin that uses floorplan view as a PDF background. Using SubmitPrint method and PrintManager configuration, views could be printed as PDFs with PDF995/Adobe Acrobat virtual printer drivers that used as a background in Xyicon application.

using (var tr = new Transaction(document, "Xyicon printer settings creation"))
{
    tr.Start();
    document.PrintManager.SelectNewPrintDriver(printer);

    var printManager = document.PrintManager;
    printManager.PrintRange = PrintRange.Select;
    ViewSheetSetting viewSheetSetting = printManager.ViewSheetSetting;
    viewSheetSetting.CurrentViewSheetSet.Views = viewSet;
    viewSheetSetting.SaveAs("Xyicon_ViewSet");
    PaperSize paperSize = null;
    foreach (PaperSize ps in printManager.PaperSizes)
    {
        if (ps.Name.Equals("ARCH E"))
        {
            paperSize = ps;
            break;
        }
    }
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.PaperSize = paperSize;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.PaperPlacement = PaperPlacementType.Center;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.ZoomType = ZoomType.FitToPage;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.PageOrientation = PageOrientationType.Landscape;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.HiddenLineViews = HiddenLineViewsType.VectorProcessing;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.RasterQuality = RasterQualityType.High;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.ColorDepth = ColorDepthType.GrayScale;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.HideCropBoundaries = false;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.HideReforWorkPlanes = false;
    printManager.PrintSetup.CurrentPrintSetting.PrintParameters.HideUnreferencedViewTags = false;

    printManager.PrintToFileName = viewPdfFilePath;
    printManager.PrintToFile = true;

    printManager.Apply();
    printManager.PrintSetup.SaveAs("Xyicon_PinterSettings");
    tr.Commit();
}

using (var tr = new Transaction(document, "Print selected view"))
{
    tr.Start();

    var printManager = document.PrintManager;
    if (elementIdListToHide.Count != 0)
        view.HideElementsTemporary(elementIdListToHide);

    document.Regenerate();
    printManager.SubmitPrint();

    while (!IsPDFHeaderExists(viewPdfFilePath))
        Thread.Sleep(1000);

    tr.Commit();
}

Recently we decided to move plugin development at APS (Autodesk Platform Services) and integrate with Xyicon, but faced with the critical view print issue. APS doesn't have ability to print a floorplan for Revit 2021 and older versions (our users still use older versions like 2020 and 2019).

In a newest Revit versions there is a PDFExport that allows us to make a PDF, but it won't work with old versions.

I thought about couple ways of implementation:

Is there any solution for this?


Solution

  • Yes, I am afraid I cannot suggest more than the options you already list. I am pretty sure that you cannot install your own virtual printer on the APS server. So, upgrading the RVT file version to a newer release or printing to some other file format are probably the most feasible options. Sorry for the bad news.