Below is a powershell script to add annotations using the technique discussed above (PdfSharp), and a demo/test attached.
Now it does not seem to require anything extra basically - can be just run from a command line (right-click, "run with powershell")
Although the powershell syntax to load and use a .net assembly is a bit awkward, it does not need the type libraries, and can be run from a command line (for batch processing).
Could be probably nice to have this as an option in PDF export settings dialog, does not really look any complicated.
The properties can be added simply by modifying the script and building the "content", or by making the "Comment" take values from the properties.
I think rich text (in particular, text with pictures in the pdf tooltips/annoations) can be also theoretically possible; but looks more troublesome, PdfSharp has no direct support for formatted text in annotation, from what I see. But, one could write raw pdf data using it, for example.
If the code gives a security error, make sure you clicked "Unlock" in zip file properties before unzipping it.
$visioFileName = $PSScriptRoot + "\demo\PdfNote.vsd"
$pdfFileName = $PSScriptRoot + "\demo\PdfNote.pdf"
Write-Host converting $visioFileName to $pdfFileName
# Load PdfSharp assembly
Add-Type -Path (Get-ChildItem -Filter PdfSharp.dll -Recurse $PSScriptRoot).FullName
# start Visio and open the document
$visio = New-Object -ComObject Visio.Application
$visio.Visible = $true
$visioDoc = $visio.Documents.Open($visioFileName)
# Export PDF, all pages
$visioDoc.ExportAsFixedFormat(1, $pdfFileName, 1, 0)
# Open exported PDF with PdfSharp
$pdfDoc = [PdfSharp.Pdf.IO.PdfReader]::Open($pdfFileName);
for ($i = 0; $i -lt $pdfDoc.PageCount; $i = $i + 1) {
$pdfPage = $pdfDoc.Pages[$i]
$visioPage = $visioDoc.Pages[1 + $i]
foreach ($visioShape in $visioPage.Shapes) {
# if comment exists
$comment = $visioShape.CellsU("Comment").ResultStr(0)
if ($comment) {
# add it as annotation
$x = $visioShape.CellsU("PinX").ResultIU - $visioShape.CellsU("Width").ResultIU / 2
$y = $visioShape.CellsU("PinY").ResultIU + $visioShape.CellsU("Height").ResultIU / 2
$annotation = New-Object PdfSharp.Pdf.Annotations.PdfTextAnnotation
$annotation.Title = $visioShape.Characters.Text
$annotation.Contents = $comment
$annotation.Icon = 6 # "note" icon
# inches to points
$point = New-Object PdfSharp.Drawing.XPoint(($x * 72), ($y * 72))
$size = New-Object PdfSharp.Drawing.XSize(0, 0)
$rect = New-Object PdfSharp.Drawing.XRect($point, $size)
$annotation.Rectangle = New-Object PdfSharp.Pdf.PdfRectangle($rect)
$pdfPage.Annotations.Add($annotation)
}
}
}
$pdfDoc.Save($pdfFileName);
$visio.Quit();