Copy link to clipboard
Copied
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).
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.
Copy link to clipboard
Copied
A test for you. Does the Revit API allow you to print to a named file (not PDF)? If so, see if you can print the same Revit document to a file, using the Adobe PDF document. It won't make a PDF! But does it finish?
Copy link to clipboard
Copied
Thank you for your reply. The Revit API does allow us to export drawings in PDF if the save dialog box isn't suppressed. When the dialog box is suppressed by modifying the registry key, the process of exporting the PDF file doesn't get complete.
Copy link to clipboard
Copied
I mean to select Print to File. I don't know if you can. In Word, for example, you can say
Document.Printout ... PrintToFile=true OutputFileName=...
This would NOT make a PDF, that's not the intent; the intent is to see which part of your process is hanging: the printing preparation or the PDF conversion.
Copy link to clipboard
Copied
Yes, the PrintToFile property is already has set to true. Below is the code snippet, I hope that may give some idea where the problem is.
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();
}
Copy link to clipboard
Copied
Oh, maybe that is the problem. You MUST NOT use "print to file" when trying to use the Adobe PDF printer if you want to make a PDF. You have to print normally, and rely on the second API to choose a destination.
Copy link to clipboard
Copied
Thank you but it didn't work either. I'm not sure why this is happening. I'm in a great stress now, tried almost everything that I could but nothing help. Can you share any other solution?
Copy link to clipboard
Copied
No, I have no other solutions to share. I can comment that some other Office apps have been reported to do this, for some users.
Copy link to clipboard
Copied
Thank you for looking at the issue. Hope it will soon be resolved.
Copy link to clipboard
Copied
Did you report it?
Copy link to clipboard
Copied
No, I don't know how to report it. Is there any link where I can report the issue?
Edit:
I'm going to send a bug report
Copy link to clipboard
Copied
Hey imaliasad​,
we are facing the same issue under Windows 7 Professional Service Pack 1 and Adobe Acrobat Pro DC (2015) v. 15.006.30418.
We are also using Revit Version 2018, but we were already able to reproduce the problem, when printing a PDF within Excel.
Do you got any respond to your bug report?
Thanks in advance.
Copy link to clipboard
Copied
Of course, it is open to debate which software has the bug. You might find this post interesting, even though it is not quite on target: PDF output takes a long time or fails; progress bar stops advancing (Adobe PDF printer) | Revit Prod...
Copy link to clipboard
Copied
Hello Imaliasad,
Sorry for the delayed response and inconvenience caused. Please check for any pending updates of Acrobat from help>check for updates, reboot the machine after installing the updates and see if this brings any difference.
If the issue persists with the latest update/patch, please share the following details:
If you wish to file a bug, you can use the following URL Feature Request/Bug Report Form
Let us know how it goes and share your findings.
Regards,
Anand Sri.