active_pdftk icon indicating copy to clipboard operation
active_pdftk copied to clipboard

dump_data returns empty stringIO

Open koenhandekyn opened this issue 13 years ago • 2 comments

on mac os x and ruby 1.9.3 with the current 'latest greatest' branch form active_activepdftk it seams that dump_data returns an empty stringIO

1.9.3-p327-turbo :030 > p.dump_data('~/Desktop/UpNxt.pdf').readlines => []

while the following nicely creates the correct data dump in to a file that contains the data. 1.9.3-p327-turbo :031 > p.dump_data('~/Desktop/UpNxt.pdf', :output => '~/Desktop/UpNxt.txt') => "~/Desktop/UpNxt.txt"

for performance and deployments reasons i'd like to avoid (temp) files. is this stringIO behaviour known ? any ideas ?

thanks koen

koenhandekyn avatar Jan 11 '13 17:01 koenhandekyn

patch below. it seems that that the puts command on a StringIO doesn't seem to behave as the author expected (anymore?).

to fix, replace call.rb#196 with

    if @output && [email protected]_a?(String)
      @output.write stdout.read 
      @output.rewind        
    end

koenhandekyn avatar Jan 12 '13 08:01 koenhandekyn

Thanks for this patch. I will test this out on multiple ruby versions. I have been testing on 1.8.7 and 1.9.2. It looks like you are using 1.9.3, I will merge and test the patch on all 3 versions, unless you want to.

Did the tests pass for you on this change?

tcocca avatar Feb 12 '13 12:02 tcocca