lib/arquivo/pdf.rb in arquivo-0.2.9 vs lib/arquivo/pdf.rb in arquivo-0.3.0
- old
+ new
@@ -5,11 +5,11 @@
I18n.config.available_locales = :pt
module Arquivo
# permite processar documentos PDF
- class C118pdf < String
+ class C118pdf
# @!group processamento
# processa pdf para arquivo
#
# @param [Hash] dad dados oficiais para reclassificacao de faturas e recibos
# @example dad
@@ -140,8 +140,23 @@
s = '2 2 moveto /Ubuntu findfont 7 scalefont ' \
"setfont (#{base}) show"
system "#{ghostscript} -sOutputFile=tmp/stamp-#{id}.pdf -c \"#{s}\";" \
"pdftk tmp/zip/#{base}.pdf " \
"stamp tmp/stamp-#{id}.pdf output #{o} #{O2}"
+ 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;rm -f #{base}/*.txt"
+ puts "#{base}-split"
end
end
end