arquivo 0.2.3 → 0.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb7ecf71153002b263d88303a43e2c298d9afc9a25bf1ff996c18016c60dc6eb
4
- data.tar.gz: 9304605a85684d6572891709c48082bf730d38ddc8c273a614ad5052a04596c3
3
+ metadata.gz: 37306fc6850e0daf5c5ad74f3c65dff487323afe2060ebfd9a0e4d042755af1e
4
+ data.tar.gz: 76d29adf388c92e326cf49244da298d9627b79b0b1514024b0f68e3478359c4a
5
5
  SHA512:
6
- metadata.gz: 00aaddf208d5ab5123858c2ea52105b2c18495e35e398059c17b982a082fcdc80762a5d6d8f75bfa43e2cc5faeb6b0b68fc7ec05c91934e1620e35f6eec4a36f
7
- data.tar.gz: 2c5f2f72098327bc4fee7df75281e5a55ded17058af3af633527750ecc04250ede81f4b06bb575d2be9b0854b73834ec10d44dfa2f1b1ed142d2c7eb02a9cc6e
6
+ metadata.gz: 10c0761fa284205166169b931ebd5bff2ab412740b25934b348a15f026251220de6fad7de10e803c6107a8fcc5cba0cba40e93a968cda0a77b5f4c1b41ea7cac
7
+ data.tar.gz: 2d25a6cba97f28a7289bfca7610011c42f29700a871ecb6ebe15fc45fc4d9de0c8717ca2310be91f295ef7f74bd37596609121c955c8fb8348348d9ac607cf14
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- arquivo (0.2.3)
4
+ arquivo (0.2.4)
5
5
  fastimage (~> 2.1)
6
6
  google-api-client (~> 0.34)
7
7
  pdf-reader (~> 2.3)
@@ -20,7 +20,7 @@ GEM
20
20
  faraday (0.17.1)
21
21
  multipart-post (>= 1.2, < 3)
22
22
  fastimage (2.1.7)
23
- google-api-client (0.36.2)
23
+ google-api-client (0.36.3)
24
24
  addressable (~> 2.5, >= 2.5.1)
25
25
  googleauth (~> 0.9)
26
26
  httpclient (>= 2.8.1, < 3.0)
@@ -54,6 +54,16 @@ module Arquivo
54
54
  end
55
55
  end
56
56
 
57
+ desc 'dsh DASHBOARD', 'processa DASHBOARD criando pdf c118'
58
+ # cria DASHBOARD c118
59
+ #
60
+ # @param [String] dashboard pdf a processar
61
+ def dsh(dashboard)
62
+ return unless File.exist?(dashboard) && File.ftype(dashboard) == 'file'
63
+
64
+ C118pdf.new(dashboard, options).faz_dashboard
65
+ end
66
+
57
67
  desc 'dir PASTA', 'processa faturas/recibos/extratos/minutas ' \
58
68
  'e cria arquivos c118'
59
69
  option :fuzz, type: :numeric, default: 29,
@@ -106,6 +106,20 @@ module Arquivo
106
106
  @nome = nil
107
107
  end
108
108
 
109
+ # @return [String] comando PDF language interpreter c118
110
+ def ghostscript
111
+ # filtrar images para scq e extratos
112
+ fi = /^[se]/i.match?(id) ? ' -dFILTERIMAGE' : ''
113
+
114
+ 'gs -sDEVICE=pdfwrite ' \
115
+ '-dNOPAUSE -dBATCH -dQUIET ' \
116
+ '-sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage ' \
117
+ '-dPDFSETTINGS=/screen -dDetectDuplicateImages ' \
118
+ '-dColorImageDownsampleThreshold=1 ' \
119
+ '-dGrayImageDownsampleThreshold=1 ' \
120
+ '-dMonoImageDownsampleThreshold=1' + fi
121
+ end
122
+
109
123
  # cria PDF do extrato
110
124
  def faz_extrato
111
125
  system "#{ghostscript} " \
@@ -115,6 +129,15 @@ module Arquivo
115
129
  nome_extrato
116
130
  end
117
131
 
132
+ # cria PDF do dashboard
133
+ def faz_dashboard
134
+ c = 'gs -sDEVICE=pdfwrite ' \
135
+ '-dNOPAUSE -dBATCH -dQUIET -dPDFSETTINGS=/printer ' \
136
+ '-sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage -dAutoRotatePages=/All'
137
+ system "#{c} -sOutputFile=#{base}-a4.pdf \"#{file}\" #{O2}"
138
+ puts "#{base}-a4"
139
+ end
140
+
118
141
  # segmenta PDF pelas suas paginas
119
142
  def split
120
143
  system "pdftk #{file} burst output #{base}/pg%04d-#{base}.pdf;" \
@@ -84,7 +84,7 @@ module Arquivo
84
84
  cria_noiseprof(m)
85
85
  end
86
86
 
87
- # @param [Float] duracao silencio
87
+ # @param [Float] sin duracao silencio
88
88
  # @param thr (see #maximo_silencio)
89
89
  # @return [Boolean] segmento audio tem som ou silencio no inicio
90
90
  def noisy?(sin, thr)
@@ -143,19 +143,5 @@ module Arquivo
143
143
  "pdftk tmp/zip/#{base}.pdf " \
144
144
  "stamp tmp/stamp-#{id}.pdf output #{o} #{O2}"
145
145
  end
146
-
147
- # @return [String] comando PDF language interpreter c118
148
- def ghostscript
149
- # filtrar images para scq e extratos
150
- fi = /^[se]/i.match?(id) ? ' -dFILTERIMAGE' : ''
151
-
152
- 'gs -sDEVICE=pdfwrite ' \
153
- '-dNOPAUSE -dBATCH -dQUIET ' \
154
- '-sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage ' \
155
- '-dPDFSETTINGS=/screen -dDetectDuplicateImages ' \
156
- '-dColorImageDownsampleThreshold=1 ' \
157
- '-dGrayImageDownsampleThreshold=1 ' \
158
- '-dMonoImageDownsampleThreshold=1' + fi
159
- end
160
146
  end
161
147
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Arquivo
4
- VERSION = '0.2.3'
4
+ VERSION = '0.2.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arquivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hernâni Rodrigues Vaz
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-12-30 00:00:00.000000000 Z
11
+ date: 2020-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler