wps 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/wps.rb +16 -0
  2. data/test.rb +10 -0
  3. metadata +46 -0
@@ -0,0 +1,16 @@
1
+ require 'win32ole'
2
+ module WPS
3
+ def doc2pdf(doc_file,pdf_file)
4
+ begin
5
+ wps=WIN32OLE.new("wps.application")
6
+ doc=wps.Documents.open(File.expand_path(doc_file))
7
+ doc.ExportPdf(File.expand_path(pdf_file))
8
+ doc.Close
9
+
10
+ ensure
11
+ wps.Terminate
12
+ end
13
+ end
14
+
15
+ module_function :doc2pdf
16
+ end
data/test.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'wps'
2
+ #WPS.doc2pdf "readme.doc","d.pdf"
3
+
4
+
5
+ require 'open-uri'
6
+ html_file="d.htm"
7
+ open("http://dashanxue.com/"){|f|
8
+ open(html_file,"w"){|w| w.write f.read}
9
+ }
10
+ WPS.doc2pdf html_file, "d.pdf"
metadata ADDED
@@ -0,0 +1,46 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wps
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - haohuoyao
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-20 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: doc2pdf by using wps com in pc windows
15
+ email: haoqisir@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - lib/wps.rb
21
+ - test.rb
22
+ homepage: http://dashanxue.com
23
+ licenses: []
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ none: false
36
+ requirements:
37
+ - - ! '>='
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubyforge_project:
42
+ rubygems_version: 1.8.23
43
+ signing_key:
44
+ specification_version: 3
45
+ summary: doc2pdf by using the windows's com of wps
46
+ test_files: []