lib/arquivo/extrato.rb in arquivo-0.2.3 vs lib/arquivo/extrato.rb in arquivo-0.2.4
- old
+ new
@@ -104,16 +104,39 @@
@nome = n.empty? ? nil : "ex#{n[1]}-#{n[0]}"
rescue StandardError
@nome = nil
end
+ # @return [String] comando PDF language interpreter c118
+ def ghostscript
+ # filtrar images para scq e extratos
+ fi = /^[se]/i.match?(id) ? ' -dFILTERIMAGE' : ''
+
+ 'gs -sDEVICE=pdfwrite ' \
+ '-dNOPAUSE -dBATCH -dQUIET ' \
+ '-sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage ' \
+ '-dPDFSETTINGS=/screen -dDetectDuplicateImages ' \
+ '-dColorImageDownsampleThreshold=1 ' \
+ '-dGrayImageDownsampleThreshold=1 ' \
+ '-dMonoImageDownsampleThreshold=1' + fi
+ end
+
# cria PDF do extrato
def faz_extrato
system "#{ghostscript} " \
"-sOutputFile=#{base}/#{nome}-extrato.pdf " \
"-sPageList=#{paginas.join(',')} \"#{file}\" #{O2}"
puts "#{nome}-extrato"
nome_extrato
+ end
+
+ # cria PDF do dashboard
+ def faz_dashboard
+ c = 'gs -sDEVICE=pdfwrite ' \
+ '-dNOPAUSE -dBATCH -dQUIET -dPDFSETTINGS=/printer ' \
+ '-sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage -dAutoRotatePages=/All'
+ system "#{c} -sOutputFile=#{base}-a4.pdf \"#{file}\" #{O2}"
+ puts "#{base}-a4"
end
# segmenta PDF pelas suas paginas
def split
system "pdftk #{file} burst output #{base}/pg%04d-#{base}.pdf;" \