Just wanted to put this on as I ran into this situation trying to convert the Infopath xml docs into a PDF writer.
I tried the right click print registry hack and modified it to open Infopath instead of Word. This ultimately failed due to the lack of switches I could find that would allow Infopath to open print close.
I tried the Bulk print vbs script on here. This did what it was supposed to but Word only pulls the XML raw code not the Infopath forms so it was not what i needed.
Finally I stumbled on a Powershell scritpt that works Perfectly. Credit here bsonposh .com /archives /468 /BSonPoSH
Printing Multiple InfoPath forms
Install details for novice users
Copy the Text between the dashed lines into Notepad. Then change the line containing "\\sharepoint.corp.com\Form_Folder" to the location of the folder needing converted for example "c:\sharepoint\Forms"
Close and Save the notepad. Now rename the .txt extention to ps1. Double Click and your off and running. FYI should you need to edit the PS1 file, Right Click Edit. The script will automatically launch the Powershell interface which you can edit in as well.
* Note if you are converting to PDF you will need a PDF writer set as the default printer. Your pdf printer should be configured to print out using the same name as the current name in Infopath so everything is kept orderly. Test on a small folder before trying a big converson.
---------------------------------------------------------------------------------------
Param($Path = "\\sharepoint.corp.com\Form_Folder",[switch]$verbose)
Write-Host
function Invoke-FormPrint
{
Param($InfoForm)
$shortname = $InfoForm.name
Write-Verbose " – FormPrint: Creating COM Object"
$infopath = New-Object -com InfoPath.Application -verbose:$false
Write-Verbose " – FormPrint: Calling Open(`$InfoForm.fullname,10)"
$infopath.XDocuments.Open($InfoForm.fullname,10) | out-null
Write-verbose " – FormPrint: Calling PrintOut()"
$infopath.XDocuments[0].printout()
sleep 10
Write-verbose " – FormPrint: Calling Quit()"
$infopath.quit()
if(!$?)
{
Write-Host " - Error printing Form: $shortname" -fore RED
}
else
{
Write-Host " - Successfully printed Form: $shortname" -fore Green
}
}
$erroractionpreference = "silentlycontinue"
if($verbose){$verbosepreference="continue";$erroractionpreference="continue"}
Write-Verbose " + Processing all Forms from: $path"
$Forms = dir $path "*.xml"
Write-Verbose " + $($Forms.count) Forms found"
Write-host " + Processing all $($Forms.count) Forms located at: $path" -fore White
foreach($Form in $Forms)
{
Write-Host " + Printing Form: $($Form.Name)" -fore White
Invoke-FormPrint $Form
}
-----------------------------------------------------------------------------------------------------------
Windows 7 with Office 2010