word_to_pdf 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/lib/word_to_pdf/version.rb +5 -0
- data/lib/word_to_pdf.rb +4 -4
- metadata +10 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cefbb3b1de62605e67622ae97622315ce0f11ff70c89de286d2b5570b1394f2c
|
4
|
+
data.tar.gz: 7f0cceb62fbf58319ae1e31c43ad839bb944236cf0780cc0df57ec45eba86515
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c6b451533a04fae54f07f2f87ecbd3b1ee4080e7ac60ecb4b52fd168f4512365c66227a11ed0da35356f0c4d4483f97b70ed446799bbf125305ae9667b70e0cb
|
7
|
+
data.tar.gz: 9889b2f5821200026a27e667eaeb74ac4a0fb7333f4dd9db4e0c2e777f55db369f4a2fcb516cae57c8babfd109865df2314bfd5385409dbfba3a2bff22c79e05
|
data/lib/word_to_pdf.rb
CHANGED
@@ -3,13 +3,13 @@ require 'securerandom'
|
|
3
3
|
require_relative 'word_to_pdf/install_check'
|
4
4
|
|
5
5
|
module WordToPdf
|
6
|
-
def self.convert(
|
6
|
+
def self.convert(_input_docx_file_path, _output_pdf_file_path, values_hash = {})
|
7
7
|
InstallCheck.ensure_office_installed!
|
8
8
|
|
9
9
|
temp_dir = "/tmp/#{SecureRandom.hex(8)}"
|
10
10
|
Dir.mkdir(temp_dir) unless File.exist?(temp_dir)
|
11
11
|
|
12
|
-
doc = Docx::Document.open(
|
12
|
+
doc = Docx::Document.open(_input_docx_file_path)
|
13
13
|
|
14
14
|
doc.paragraphs.each do |p|
|
15
15
|
values_hash.each do |key, value|
|
@@ -23,8 +23,8 @@ module WordToPdf
|
|
23
23
|
system("soffice --headless --convert-to pdf #{filled_docx} --outdir #{temp_dir}")
|
24
24
|
|
25
25
|
generated_pdf = filled_docx.gsub('.docx', '.pdf')
|
26
|
-
File.rename(generated_pdf,
|
26
|
+
File.rename(generated_pdf, _output_pdf_file_path)
|
27
27
|
|
28
|
-
puts "PDF generated: #{
|
28
|
+
puts "PDF generated: #{_output_pdf_file_path}"
|
29
29
|
end
|
30
30
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: word_to_pdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ajit Dhanje
|
8
8
|
bindir: bin
|
9
9
|
cert_chain: []
|
10
|
-
date: 2025-04-
|
10
|
+
date: 2025-04-06 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: docx
|
@@ -23,14 +23,18 @@ dependencies:
|
|
23
23
|
- - "~>"
|
24
24
|
- !ruby/object:Gem::Version
|
25
25
|
version: 0.8.0
|
26
|
+
email:
|
27
|
+
- ajitdhanje@gmail.com
|
26
28
|
executables: []
|
27
29
|
extensions: []
|
28
30
|
extra_rdoc_files: []
|
29
31
|
files:
|
30
32
|
- lib/word_to_pdf.rb
|
31
33
|
- lib/word_to_pdf/install_check.rb
|
34
|
+
- lib/word_to_pdf/version.rb
|
32
35
|
licenses: []
|
33
|
-
metadata:
|
36
|
+
metadata:
|
37
|
+
source_code_uri: https://github.com/dhanajit96/word_to_pdf.git
|
34
38
|
rdoc_options: []
|
35
39
|
require_paths:
|
36
40
|
- lib
|
@@ -38,7 +42,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
41
|
-
version:
|
45
|
+
version: 3.1.0
|
42
46
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
43
47
|
requirements:
|
44
48
|
- - ">="
|
@@ -47,6 +51,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
51
|
requirements: []
|
48
52
|
rubygems_version: 3.6.6
|
49
53
|
specification_version: 4
|
50
|
-
summary: A gem to convert word file
|
51
|
-
|
54
|
+
summary: A gem to convert word file(.docx) to pdf can be used for invoicing and other
|
55
|
+
template
|
52
56
|
test_files: []
|