I am using this VBA In MicroStation CONNECT Edition Update 12 to batch print Dgn files that contain a both model and a sheet and it works well but creates a separate PDF file for each Model/Sheet. I would like it to create a single PDF file that contains all models/sheets for each DGN. Does anyone know what in need to add to the VBA to make it create a single PDF file?
Sub PrintPDF_XXXX() Dim DirPath As String Dim FileName As String Dim FileBaseName As String Dim SaveFileName As String Dim ModelName As String CadInputQueue.SendCommand "MDL SILENTLOAD PLOTDLG"
CadInputQueue.SendCommand "PRINT DRIVER AE_SUB_pdf(no view).pltcfg"
DirPath = ActiveModelReference.DesignFile.Path FileName = ActiveModelReference.DesignFile.Name FileBaseName = Left(FileName, Len(FileName) - 4) ModelName = ActiveModelReference.Name SaveFileName = DirPath + "\" + FileBaseName + "-" + ModelName + ".pdf" CadInputQueue.SendCommand "PRINT EXECUTE " & SaveFileName CommandState.StartDefaultCommandEnd Sub
Hi Chad,
please follow best practices: To do not specify exactly what product and version you use makes the discussion more complicated.
Is there any reason why to do not use Print Organizer, that supports merging of all prints into one PDF already?
Regards,
Jan
Bentley Accredited Developer: iTwin Platform - AssociateLabyrinth Technology | dev.notes() | cad.point
I haven't had any luck with Print Organizer either. I can get it to work for one file by submitting to a single job but not for when I am printing multiple files. I also don't get the option of using the source file name when printing to a single job. Maybe there is a way to get print organizer to do what I want, but I have not been able to figure it out.
Chad Meyerhofer said:I can get it to work for one file by submitting to a single job but not for when I am printing multiple files.
It's hard to say what can be wrong, but from V8i version Print Organizer allows to define (when pdf.pltcfg is used), whether printed models should be saved as separate print jobs or merged into one PDF (single print job).
Chad Meyerhofer said: I also don't get the option of using the source file name when printing to a single job.
Output file name is defined through Print definition Name Expression. There is a list of pre-defined, or custom Expression can be created.
Chad,
I see what you mean, when you set Print Organizer to single print job, you don't get all the file naming options / named expressions.
I do not know if you can use named expressions in key-ins like config variables. That would be the simplest solution.
Jan's point about using Print Organizer is a good one. You can drive print organizer with key ins. You've figured out the VBA part, so if you combine the print organizer key ins to load your pset you should be able to set the output file name using VBA. You do need to have print organizer loaded to see all the key-ins. I had to do something similar a few years ago when I set up Print Organizer to plot overnight.
Tom F.
From Microstation's help on Print organizer:
printorganizer printdestination <your path and file name here>
Tom F