lib/libis/format/converter/pdf_converter.rb in libis-format-1.0.4 vs lib/libis/format/converter/pdf_converter.rb in libis-format-1.0.5
- old
+ new
@@ -126,11 +126,11 @@
def optimize_pdf(source, target, quality)
using_temp(target) do |tmpname|
result = Libis::Format::Tool::PdfOptimizer.run(source, tmpname, quality)
unless result[:status] == 0
- error("Pdf optimization encountered errors:\n%s", (result[:err] + result[:out]).join('\n'))
+ error("Pdf optimization encountered errors:\n%s", (result[:err] + result[:out]).join("\n"))
next nil
end
tmpname
end
end
@@ -138,19 +138,19 @@
def convert_pdf(source, target)
using_temp(target) do |tmpname|
result = Libis::Format::Tool::PdfCopy.run(
source, tmpname,
- @options.map { |k, v|
+ @options.map {|k, v|
if v.nil?
nil
else
["--#{k}", (v.is_a?(Array) ? v : v.to_s)]
- end }.flatten
+ end}.flatten
)
unless result[:err].empty?
- error("Pdf conversion encountered errors:\n%s", result[:err].join('\n'))
+ error("Pdf conversion encountered errors:\n%s", result[:err].join(join("\n")))
next nil
end
tmpname
end
@@ -158,12 +158,14 @@
def pdf_to_pdfa(source, target)
using_temp(target) do |tmpname|
result = Libis::Format::Tool::PdfToPdfa.run source, tmpname
- unless result[:status] == 0
- error("Pdf/A conversion encountered errors:\n%s", result[:err].join('\n'))
+ if result[:status] != 0
+ error("Pdf/A conversion encountered errors:\n%s", result[:err].join("\n"))
next nil
+ else
+ warn("Pdf/A conversion warnings:\n%s", result[:err].join("\n")) unless result[:err].empty?
end
tmpname
end
end