diff --git a/lib/wisepdf/writer.rb b/lib/wisepdf/writer.rb
index <HASH>..<HASH> 100644
--- a/lib/wisepdf/writer.rb
+++ b/lib/wisepdf/writer.rb
@@ -12,6 +12,7 @@ module Wisepdf
       self.log(invoke) if Wisepdf::Configuration.development? || Wisepdf::Configuration.test?
 
       result, err = Open3.popen3(invoke) do |stdin, stdout, stderr|
+        stdin.binmode
         stdin.write(string)
         stdin.close
         [stdout.read, stderr.read]
Added binmode to popen3 call.