在打印PDF

时间:2017-04-14 18:31:47

标签: c# revit-api

我已经成功创建了一个程序来创建PDF文件而无需重新格式化文件名(Revit剥离点并放入破折号,并在文件名前加上整个模型名称)。但是,一旦PDF被“创建”,它仍然被移植到Bluebeam Revu(REAL保存到文件的地方)。如何让Revit在指定的文件夹中创建具有指定名称的文件,而无需调用Bluebeam“中间”对话框?

//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";

我尝试了“... PrintParameters”的各种选项,似乎没有任何选项可以抑制由定义的打印机调出的对话框。

2 个答案:

答案 0 :(得分:1)

BlueBeam没有直接的方法。您必须启动BlueBeam管理员并取消选中"提示输入文件名"选项(如果打开则调用BlueBeam Revu的对话框控件)。当您关闭它时,您的文件(具有正确的名称但不是路径)将放置在您的MyDocuments文件夹中(通过以下方式访问:

var yourWord = document.getElementById("myText").value;

var yourtext = "I took the word " + yourWord + "...";


var infomation = [yourtext,
        'I looked at the most relevant news article relating to it...',
        'And created this piece of art from the words in the article! '
    ],

    part,

    i = 0,
    offset = 0,
    pollyLen = Polly.length,
    forwards = true,
    skip_count = 0,
    skip_delay = 5,
    speed = 100;

var wordflick = function () {
    setInterval(function () {
        if (forwards) {
            if (offset >= infomation[i].length) {
                ++skip_count;
                if (skip_count == skip_delay) {
                    forwards = false;
                    skip_count = 0;
                }
            }
        } else {
            if (offset == 0) {
                forwards = true;
                i++;
                offset = 0;
                if (i >= pollyLen) {
                    i = 0;
                }
            }
        }
        part = infomation[i].substr(0, offset);
        if (skip_count == 0) {
            if (forwards) {
                offset++;
            } else {
                offset--;
            }
        }
        $('#pollyInfo').text(part);
    }, speed);
};

$(document).ready(function () {
    wordflick();
});

创建文件后(注意"转换"等,可能会延迟它们可供复制),您可以将它们复制到PDF_Mage.PrintToFileName指定的文件夹中。我这样做是通过插入一个TaskDialog暂停直到准备好。

答案 1 :(得分:0)

以下是一个完整的示例,演示了如何打印到PDF并控制输出文件名和路径:

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