我使用Ruby來顯示網頁中的PowerPoint文件的內容。我已經找到使用win32ole的解決方案,但是我在linux環境中,它不起作用。我認爲該應用程序可能會觸發一個openoffice命令進行轉換。如何將ppt轉換爲Ruby中的圖像?
4
A
回答
4
您可以使用Rjb和JODConverter將您的powerpoint導出到閃存(或any other format)。
這裏是一個代碼PICE做到這一點:
require 'rubygems'
require 'rjb'
classpath = nil
Rjb::load(classpath, ['-Djava.awt.headless=true'])
jFile = Rjb::import('java.io.File')
jSocketOpenOfficeConnection = Rjb::import('com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection')
jOpenOfficeDocumentConverter = Rjb::import('com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter')
input = jFile.new("your-doc.ppt")
output = jFile.new("your-doc.swf")
# connect to an OpenOffice.org instance running on port 8100
connection = jSocketOpenOfficeConnection.new(8100)
connection.connect()
# convert
converter = jOpenOfficeDocumentConverter.new(connection)
converter.convert(input, output)
# close the connection
connection.disconnect()
您需要啓動一個OOo.org服務器:
soffice -headless -accept="socket,host=127.0.0.1,port=8100;urp;" -nofirststartwizard
並以jodconverter-cli-X.X.X.jar
添加到您的CLASSPATH
7
相關問題
- 1. 將ppt轉換爲圖像
- 2. C#轉換爲.ppt圖像
- 3. 如何將ppt幻燈片轉換爲php中的jpeg圖像
- 4. 將PPT文件轉換爲Android中的圖像
- 5. 是否可以將PPT轉換爲Windows Phone中的圖像?
- 6. 如何將EPS,DOC和PPT文檔轉換爲PHP中的預覽圖像?
- 7. 如何將圖像字符串轉換爲Ruby中的流
- 8. 將功率點(ppt)文件轉換爲圖像
- 9. C#MS Office PPT到圖像轉換
- 10. 如何將圖像轉換爲位圖
- 11. 如何將圖像轉換爲圖標?
- 12. 如何將位圖轉換爲圖像
- 13. 在PPT中將PPTX或PPT文件轉換爲PDF格式
- 14. 如何將圖像轉換爲android中的文本轉換器?
- 15. 像我們在OpenOffice中一樣將.ppt轉換爲.pdf?
- 16. 如何將base64-encode圖像轉換爲imagemagick中的PNG圖像?
- 17. 如何將風景圖像轉換爲IOS6中的portrate圖像?
- 18. 如何將圖像轉換爲java中的透明圖像
- 19. 如何將Ipl圖像轉換爲Java中的Mat圖像
- 20. 如何將圖像轉換爲opencv中的浮動圖像?
- 21. 如何將索引圖像轉換爲Java中的RGB圖像?
- 22. 如何將索引圖像轉換爲C#中的RGB圖像?
- 23. 使用APACHE POI將PPT轉換爲圖像時,將中文字符轉換爲正方形
- 24. 通過python將PPT轉換爲PNG
- 25. 將htm文件轉換爲ppt文件
- 26. 將ppt或pptx文件轉換爲jpg
- 27. 將ppt轉換爲PDF時出錯
- 28. 將pdf,doc,ppt轉換爲html5
- 29. 將xml文件轉換爲.doc或.ppt
- 30. 如何將圖像轉換爲字節[]?