0

I have successfully created a program to create PDF files without reformatting the file name (Revit strips out dots and puts in dashes, and prefixes the file name with the entire model name). However, once the PDF is "created" it is still ported to Bluebeam Revu (where the REAL save to file is done). How do I get Revit to create the file with exactly the name specified, in the folder specified, without calling up the Bluebeam "intermediary" dialog?

//this is my code as written....


string PDF_Path = "C:\\Revit Local\\" + Each_Sheet + " - " + Each_Name + ".pdf";
IPrintSetting PDF_Sets = PDF_Manage.PrintSetup.CurrentPrintSetting;
PrintParameters PDF_Params = PDF_Sets.PrintParameters;
PDF_Params.PaperSize.Equals(Use_Size);
PDF_Params.PageOrientation = PageOrientationType.Landscape;
PDF_Params.ZoomType = ZoomType.Zoom;
PDF_Params.Zoom = 100;
PDF_Params.PaperPlacement = PaperPlacementType.Center;
PDF_Params.HideReforWorkPlanes = true;
PDF_Params.HideUnreferencedViewTags = true;
PDF_Params.HideCropBoundaries = true;
PDF_Params.HideScopeBoxes = true;
PDF_Params.ColorDepth = ColorDepthType.GrayScale;
PDF_Manage.SubmitPrint(uiDoc.ActiveView)
PDF_Manage.PrintToFileName = "MyFileNameVariable.pdf";

I tried the various options of "...PrintParameters" and none seemed to suppress the dialog called up by the printer defined.

  • Oh, and the PDF_Manage.PrintToFileName is located before the SubmitPrint(uiDoc.ActiveView). I was copying another 2 lines of my code and placed them in the wrong location in my question – KeachyPeenReturns Apr 14 '17 at 19:06
  • UPDATE: Bluebeam has a setting in it's Administrator tool to turn off the prompt for file name option. However, the PDF file is NOT created in the location specified under the PDF_Manage.PrintToFileName location. – KeachyPeenReturns Apr 14 '17 at 21:57
  • The default BlueBeam location is Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) – KeachyPeenReturns Apr 17 '17 at 13:43

2 Answers2

1

There is no direct method with BlueBeam. You have to start the BlueBeam administrator and uncheck the "Prompt for file name" option (which if turned on calls up the dialog control of BlueBeam Revu). When you turn it off, your files (with the correct name but not path) are placed in your MyDocuments folder (accessed via the following :

Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)

After the files are created (note that "conversion", etc, might delay them being available to copy), you can copy them over to the FOLDER designated by your PDF_Mage.PrintToFileName. I did this by inserting a TaskDialog to pause until ready.

0

Here is a complete sample demonstrating how you can print to PDF and control the output filename and path:

http://thebuildingcoder.typepad.com/blog/2013/06/auto-pdf-print-from-revit-2014.html

Jeremy Tammik
  • 7,333
  • 2
  • 12
  • 17
  • Thanks, but the above suggestion doesn't work with BlueBeam. When the "Prompt for filename" option is turned off, the file is directed to MyDocuments. I have written code to then copy the file from that folder to the location defined by my PDF_Manage.PrintToFileName = "MyFileNameVariable.pdf"; – KeachyPeenReturns Apr 17 '17 at 12:35
  • but this seems to be limited by how quickly the "finished" file is detectable by File.Exists after "SubmitPrint".....if not found (yet), I obviously can't copy it to the desired location. This is a bug in the interface between Revit and BlueBeam -- it should ONLY put the file exactly where the PDF_Manage.PrintToFileName requested. – KeachyPeenReturns Apr 17 '17 at 12:38
  • So I added a TaskDialog (Yes/No options) that awaits user input to "go ahead and copy found files". (Complex sheets can take more than a few seconds to "finish" – KeachyPeenReturns Apr 19 '17 at 15:32