Highlighted

Adobe PDF Printer Doesn't Creating the PDF Files

New Here ,
Mar 07, 2018

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.

XYOvD.png

Topics

Create PDFs, Windows

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Adobe PDF Printer Doesn't Creating the PDF Files

New Here ,
Mar 07, 2018

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.

XYOvD.png

Topics

Create PDFs, Windows

Views

1.4K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Most Valuable Participant ,
Mar 08, 2018

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 08, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Mar 08, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 08, 2018

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();

        }

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Mar 08, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 08, 2018

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?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Most Valuable Participant ,
Mar 08, 2018

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
New Here ,
Mar 08, 2018

Copy link to clipboard

Copied

Thank you for looking at the issue. Hope it will soon be resolved.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...