hexagon logo

2016 report printing issue

I've been using the same vb.net application to print (PDF and hard copy) from PCDMIS 2011 for a few years now. In 2016 it no longer works the same. After printing once, it will not print a second time. PCDMIS doesn't even flinch when the second set of commands are called. If I print the PDF first, it skips the hard copy, if I print the hard copy first, it skips the PDF...no matter what, it will not print twice in a row, like it used to. We have upgraded 7 machines to 2016, all have the same problem.

Any thoughts??


'print to PDF

[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]prt.EditWindow.SetPrintOptionsEx(PCDLRN.[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]PCDPRINTLOC[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].PCD_FILE, PCDLRN.[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]ENUM_PCD_ON_OFF[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].DMIS_ON, PCDLRN.[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]PCDPRINTFILEMODE[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].PCD_NEWFILE, 1, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]sPath[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2], PCDLRN.[/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]PCDFILEPRINTFORMAT[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].PCD_PDF, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff][FONT=Consolas][SIZE=2][COLOR=#0000ff]False[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2])[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]RepWin.PrintReport()

'print hard copy

prt.EditWindow.SetPrintOptions([/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]PCDPRINTLOC[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].PCD_PRINTER, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]ENUM_PCD_ON_OFF[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].DMIS_ON, [/SIZE][/FONT][/SIZE][/FONT][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af][FONT=Consolas][SIZE=2][COLOR=#2b91af]PCDPRINTFILEMODE[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2].PCD_OVERWRITE, 1)[/SIZE][/FONT][/SIZE][/FONT]
[FONT=Consolas][SIZE=2][FONT=Consolas][SIZE=2]RepWin.PrintReport()[/SIZE][/FONT][/SIZE][/FONT]


  • AFAIK, printing twice never worked in PC-DMIS, whether it has been through "normal" printing commands or through scripting. Have raised this particular issue during a technical preview a couple of versions back but never revisited it to try if it works yet.


    I have had no problem with this (scripting) up through 2011. We jumped from 2011 to 2016 and I started seeing the issue.

    Thanks for looking in to this everybody. I guess I'm stuck with sacrificing machine time for the time being. I'm going to look in to creating a PDF, and then printing a hard copy from the PDF itself. Unfortunately, it looks like there are only 3rd party solutions for that.
  • I haven't tried, but if you can produce a PDF file with a known name (path), you should be able to send that same name as parameter to a .BAT-file (EXTERNALCOMMAND) doing the hard copy?
  • I've tried playing with that a bit, but opening Adobe Reader, printing, and closing after the printing is done...seems to not work very well. Everywhere I look, 3rd party applications are the only answer to Adobe automation. :-\
  • This is a bat file I use to close all PDF's

    Close PDF.bat
    taskkill /IM acrord32.exe

    This is a bat file I use to open a PDF

    Calibration Report.bat
    start "" /D"X:\your file location\Calibration Reports" "Calibration Report.PDF"

  • What about the old "print" command, like
    CMD> print abc.pdf
    (I don't know how you would associate PRN: with a printer, but it should be possible)
  • I'm able to print from adobe reader, just can't close it afterwards. At least, not without killing it mid-process. But, we've decided that leaving adobe open is not so bad, considering the time savings of not refreshing the report twice in PCDMIS, AND not waiting for PCDMIS to send the report to the printer...adobe will run concurrent to the rest of the PCDMIS processing, so it's actually a huge benefit for us.
  • Thank you. How do you confirm that adobe is finished sending the file to the printer before killing it?
  • why don't you print & pdf at the same time?

    SetPrintOptionsEx's first paramter is where to output. I don't know VB method of or'ing 2 variables together (c++ would be PCDLRN.PCDPRINTLOC.PCD_FILE | PCDPRINTLOC.PCD_PRINTER)

     prt.EditWindow.SetPrintOptionsEx(PCDLRN.PCDPRINTLOC.PCD_FILE, PCDLRN.ENUM_PCD_ON_OFF.DMIS_ON, PCDLRN.PCDPRINTFILEMODE.PCD_NEWFILE, 1, sPath, PCDLRN.PCDFILEPRINTFORMAT.PCD_PDF, False)  
     RepWin.PrintReport()



    vs. ( again not sure about combining the values) Maybe just adding them together?

     prt.EditWindow.SetPrintOptionsEx(PCDLRN.PCDPRINTLOC.PCD_FILE | PCDPRINTLOC.PCD_PRINTER  
     , PCDLRN.ENUM_PCD_ON_OFF.DMIS_ON, PCDLRN.PCDPRINTFILEMODE.PCD_NEWFILE, 1, sPath, PCDLRN.PCDFILEPRINTFORMAT.PCD_PDF, False)  
     RepWin.PrintReport()


    the 2nd method will generate the output for both file & printer.
  • I use this batch fill with INSPECT for open reports that INSPECT is set to open and with Auto Calibration using INSPECT. So the PDF reports are already have been open by INSPECT or the Print Commands in PC-DMIS. So if the operator forgets to close any open PDF's the batch file will close all PDF's. This way when the print command needs to overwrite or append the report the batch file will close PDF's before the execution of the Print Commands or INSPECT reports. This is the biggest weakness of PC-DMIS with reporting and reporting file saves. I would say that 90% of my PC-DMIS template size is to handle the reporting side of the program. Most of this should be handle outside of the Edit Window.
  • I didn't know you could combine them! I simply used "Or" in place of the pipe, and it works perfectly. Thanks for that!!