开发者

Converting PPT to SVG using Microsoft Office 2010 PIA

I'm trying to convert a powerpoint presentation to seperate svg files (1 for e开发者_高级运维ach slide), Is it possible to do so by using the Microsoft Office 2010 PIA ?

If so, then is there any tutorial on using Microsoft Office 2010 PIA in Java ?


There are no off-the-shelf automatic converters that I know of, but I had success in saving each individual slide as PDF in Powerpoint, then opening the PDF in Inkscape and resaving as SVG. Both Powerpoint's PDF export and Inkscape's PDF importing are quite sophisticated and produce good results, and SVG is Inkscape's native saving format, but some tweaking of the imported PDF in Inkscape may be required to reproduce certain elements in the original precisely.

It may have made a difference that I have Adobe Acrobat installed, but I did not use the "Save as Adobe PDF" plugin, just the ordinary "Save As" dialog. Using Save as Adobe PDF produced inferior results.


I had better success exporting as Enhanced Windows meta file (.emf) which Inkscape also can read.

It was 'better' because when I tried to import the exported PDF, Inkscape generated a bunch image files. The XML of the imported SVG seemed cleaner as well.


I realize this is an old question, but I recently tried to do this and found a solution that worked pretty well using Google Slides:

  1. Upload the PowerPoint to Google Drive, then click Open in Google Slides, OR
  2. Create a new Google Slides presentation, then click File -> Import Slides... and pull in the slides you need.
  3. File -> Download as -> Scalable Vector Graphics (.svg, current slide).


This is how I'm doing it (without Office PIA).

  1. Run a macro to split the PPTX in as many PDF files as slides in the presentation.
  2. Use inkscape to convert each PDF to SVG

VBA Macro

Sub ExportAllSlidesInPDF()

  Dim SourceView, answer As Integer
  Dim SourceSlides, NumPres, x As Long
  Dim ThisSlideFileNamePDF As String

  NumPres = Presentations.Count

  If NumPres = 0 Then
     MsgBox "No Presentation Open", vbCritical, vbOKOnly, "No Presentations Open"
  End If

  SourceView = ActiveWindow.ViewType
  SourceSlides = ActivePresentation.Slides.Count

  For x = 1 To SourceSlides
     Presentations.Add
     With ActivePresentation.PageSetup
        .SlideHeight = Presentations(1).PageSetup.SlideHeight
        .SlideWidth = Presentations(1).PageSetup.SlideWidth
     End With

     If ActiveWindow.ViewType <> ppViewSlide Then
        ActiveWindow.ViewType = ppViewSlide
     End If

     Presentations(1).Windows(1).Activate
     If ActiveWindow.ViewType <> ppViewSlideSorter Then
        ActiveWindow.ViewType = ppViewSlideSorter
     End If

     ActivePresentation.Slides.Range(Array(x)).Select
     ActiveWindow.Selection.Copy

     Presentations(2).Windows(1).Activate
     If ActiveWindow.ViewType <> ppViewSlide Then
        ActiveWindow.ViewType = ppViewSlide
     End If

     ActiveWindow.View.Paste
     ActiveWindow.Selection.Unselect

     ThisSlideFileNamePDF = "Slide_" & x & ".pdf"
     ActivePresentation.SaveAs ThisSlideFileNamePDF, ppSaveAsPDF
     ActivePresentation.Close

     Presentations(1).Windows(1).Activate

  Next x

  ActiveWindow.ViewType = SourceView

End Sub

This can be improved (e.g. dialogs, more controls, add as an addin) but here it is in principle.

inkscape step

Single-liner for a Linux box:

for file in *.pdf; do inkscape --without-gui "--file=$file" "--export-plain-svg=${file%%.*}.svg"; done


This is going to be pretty hard, there is no direct way to do this afaik (please correct me if I'm wrong!) - the easiest way would be to Print to XPS, then convert the XAML (XPS == XAML + Zip file) to an SVG file; this isn't easy or straightforward either, but the mapping between XAML => SVG is probably far closer.


It's not the smoothest of translations, but check out the pptx4j component of docx4j to render most items in SVG: http://dev.plutext.org/svn/docx4j/trunk/docx4j/src/pptx4j/java/org/pptx4j/samples/RenderAsSvgInHtml.java


On Mac OSX it is not optimised to be used from command line [1], so you need to add an absolute path to your files:

for file in *.pdf; do inkscape --without-gui "--file=${PWD}/${file}" "--export-plain-svg=${PWD}/${file%%.*}.svg"; done

Otherwise you get this error message:

** Message: couldn't open the PDF file.

** (inkscape-bin:13267): WARNING **: Can't open file: myfile.pdf (doesn't exist)

** (inkscape-bin:13267): WARNING **: Specified document myfile.pdf cannot be opened (does not exist or not a valid SVG file)

[1] Inkscape on OSX cannot open PDF file through terminal command

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜