Using PDFCreatotr with Revit


#1

I am trying to use PDF Creator 3.0.2 with Revit 2014 through 2018. Specifically, I have a Revit Add-In written in C# that uses the Revit API to batch print PDF Files. I have configured an AutoSave profile but am having issues setting the Folder value (TargetDirectory) value. I cannot set the TargetDirectory from within my C# code using either Registry calls or the COM Wrapper. The only way I can get things to work is to set the TargetDirectory using the PDFCreator UI and hard coding the Folder field. I do not have the same issue with the FileName (FileNameTemplate) field. Is this behavior by design or is there a bug in PDFCreator preventing the Folder value from being set?


#2

Hi,

it should work with the COM wrapper, could you share a little code snippet or additional details? The COM workflow doesn’t know a setting for automatic saving, it is always automatic; because of this, you also can’t change the setting for the target directory, but rather call ConvertTo(path) for the print job directly. There are some C# examples in the “COM Scripts” folder which gets installed together with PDFCreator.
Changing the setting through the registry should also be possible, but will only work if you set it before PDFCreator is loaded.

Best regards,

Robin


#3

Here is a short snippet of code. This does not include setup code that sets the Revit Printing API to the PdfCreatorAutoSave virtual printer.

plotView.Print(true); // print a sheet using the Revit API
if (jobQueue.Count > 0) // there is a job in the queue
{
PrintJob printJob = jobQueue.NextJob;
printJob.SetProfileByGuid(“7d76f5b5-add8-4dc8-a399-a6e7df684b5b”);
printJob.SetProfileSetting(“FileNameTemplate”, Path.GetFileNameWithoutExtension(pdfOutputFilename)); // the actual filename
printJob.SetProfileSetting(“TargetDirectory”, “exportFolder”); // the output folder
}

I will replace the SetProfileSetting calls with the ConverTo(path) call to see if this works.


#4

The code below seems to be working. I have some large jobs (800+ PDF files) I need to test with, but so far, things look good.

plotView.Print(true); // print a sheet using the Revit API
if (jobQueue.Count > 0) // there is a job in the queue
{
PrintJob printJob = jobQueue.NextJob;
printJob.SetProfileByGuid(“7d76f5b5-add8-4dc8-a399-a6e7df684b5b”);
printJob.ConvertTo(networkPdfOutputFilename);
}