You can look into SaveAs and pick SVG as the desired format. Something of this sort:
Wouldn't that imply embedding this line of code into every PB-file?
We need something which doesn't require manual operation at all. Maybe a PB plugin?
You could run the following from a display or from an Excel sheet etc providing you have references to the PBObjLib and PBSymLib...
Const sDir As String = "C:\"
Dim app As PBObjLib.Application
Set app = New PBObjLib.Application
app.Visible = True
Dim pb As PBObjLib.ProcBook
Set pb = app.ProcBooks.Open(sDir & "MyTest.piw")
Dim e As Entry
For Each e In pb.Entries
' Just processing embedded displays, not linked displays
If e.Type = 1 Then
Dim Disp As Display
Set Disp = app.ActiveDisplay
Call Disp.SaveAs(sDir & Split(Disp.Path, "!")(UBound(Split(Disp.Path, "!"))) & ".svg", pbpdFormatSVG)
Set Disp = Nothing
Set pb = Nothing
Set app = Nothing
Obviously you will need to modify the code to suit your needs.
Mmhh - Borre,
that sits on my ToDo list for some weeks now. The basic idea is taking the Export.PDI that comes with ActiveView and modify it to save SVG's.
I did a little VB6 program years ago that takes all PDI's in one directory and saves them as SVG. This little VB6 programm did resize the PDI's because there were some issues in the visible area of an SVG compared to the PDI. and in addition it put a little PI value symbol in the corner to show the timestamp.
So my plan was combining these two...
I did this a few years ago, I had a 'Macros' display with lots of useful tools for the particular project. One of the tools took the active Book, opened each display in turn, sized the display (the saved SVG basically looks like the it does in Processbook at the time it is saved so you must ensure that you can see the entire display in the window, as Andreas hinted), saved it as SVG and closed it.
If I get the chance, I may be able to find it but I can't promise!
Thanks guys, confirms at least there isn't a straight forward solution to it.
@Rhys: we will see if we give that a try. Good starting point if we do
@Andreas: Whatcha waiting for...Do it, get it of your ToDo list right away
I have to convert 180 PDI displays to SVG so that i can use them on Webparts and also while converting the display i want ensure that the display are save in " Zoom= FitAll" mode. For this bulk conversion i had written the following basic code as per my undersatnding (Newbee) but unfortunately after converting some displays it hangs. Can anyone give this a try ?
Public Function FileList(Mask As String) As String()
Dim file As String
Dim sAns() As String
Dim i As Integer
file = Dir(Mask, vbNormal)
i = 0
While (file <> "")
ReDim Preserve sAns(i) As String
sAns(i) = file
i = i + 1
file = Dir
FileList = sAns
Private Sub cmdSvg_Click()
Dim sarr() As String
Dim path As String
path = TextBox1.Text & "\"
sarr = FileList(path & "*.pdi")
For Each file In sarr
Dim newfile As String
newfile = Replace(file, ".pdi", ".svg", , , vbTextCompare)
Dim d As Display
Set d = Application.Displays.Open(path & file, True)
d.Zoom = "FitAll"
d.SaveAs path & newfile, pbpdFormatSVG
I also used Excel as a platform to build and maintain the list of PDI's, and to host the VBA code calling the ProcessBook automation objects to convert to .SVG. You can also extend this to do pre- and post-processing on the PDI and SVG files, which i found to be a requirement almost always needed in automated conversions.