Adobe pdf打印机未创建pdf文件 [英] Adobe pdf printer doesn't creating the pdf file

查看:616
本文介绍了Adobe pdf打印机未创建pdf文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在

I'm creating an add-in in Revit 2017. The addin will export drawing sheets to PDF files. So, whenever I try to export the sheet a dialog box appears to choose the location to save. I tried to turn off the Prompting programmatically by adding a key to the Windows registry (as described in Adobe documentation page 15-16).

现在,提示已关闭,现在我遇到了一个问题. 问题是Adobe打印机在创建pdf文件时卡住了.参见下图: PDF创建进度条似乎被冻结,我等待了10分钟以上,但没有创建pdf文件.

Now, the prompting got turned off and now I'm facing an issue. The issue is the Adobe Printer got stuck while creating the pdf file. See the below image: The PDF creating progress bar seems frozen, I waited for more than 10 mins and it didn't create the pdf file.

有人可以提供任何修复程序吗? 感谢任何建议.

Can anybody provide any fix? Appreciate any suggestion.

修改 这是我为此目的编写的代码.我希望这可以帮助您确定问题所在.

Edit here's the code that I've written for this purpose. I hope this may help to identify the problem.

public static bool ExportSheetToPDF(Document doc, string path)
{
    using (Transaction tx = new Transaction(doc)
    {

        tx.Start("Exportint to PDF");         

        PrintManager pm = doc.PrintManager;
        pm.SelectNewPrintDriver("Adobe PDF");
        pm.Apply();
        pm.PrintRange = PrintRange.Current;
        pm.Apply();
        pm.CombinedFile = true;
        pm.Apply();
        pm.PrintToFile = true;
        pm.Apply();
        pm.PrintToFileName = path + @"\PDF\" + "abc.pdf";
        pm.Apply();
        SuppressAdobeDialogAndSaveFilePath(path + @"\PDF\" + "abc.pdf");

        pm.SubmitPrint();
        pm.Apply();
        tx.Commit();

    }
    return true;
}

// Add Registry Key to suppress the dialog box
public static void SuppressAdobeDialogAndSaveFilePath(string value)
{
    var valueName = @"C:\Program Files\Autodesk\Revit 2017\Revit.exe";
    var reg = currentUser.OpenSubKey(key, true);
    var tempReg = reg.OpenSubKey(valueName);
    if (tempReg == null)
    {
        reg = reg.CreateSubKey(valueName);
    }
    reg.SetValue(valueName, value);
    reg.Close();
}

推荐答案

我已经解释了如何通过覆盖Revit.exe进程的注册表项来实现此目的,Revit.exe进程用于Adobe生成下一张打印件.

I have explained how you can achieve this by overriding the registry key for Revit.exe process that Adobe uses to generate the next print.

http://archi- lab.net/printing-pdfs-from-revit-为什么这么硬/

请记住,您仍然必须通过Revit PrintManager进行打印,但是您可以在每次打印之前设置注册表项,以控制文件的保存位置.

Please remember that you still have to print via Revit PrintManager, but then you can set the registry keys before every print to control where the files get saved.

这篇关于Adobe pdf打印机未创建pdf文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆