Reputation: 687
I'm converting pdf files in my Ruby project. I'm using the pdf toolkit gem for this.
The documentation shows how you can use pdftotext pdftotext(file,outfile = nil,&block)
In my project I am converting a PDF file without any arguments and can just do this: PDF::Toolkit.pdftotext("file.pdf", "file.txt)
If I run it from the command line, I can preserve the layout by passing that param pdftotext -layout file.pdf
What is the correct syntax to achieve this with PDF::Toolkit?
Thanks!
Upvotes: 2
Views: 1383
Reputation: 687
Figured out how to make it work so I'm answering my own question, but if there's a "proper way" to do this, I'd love to see how to do it.
Put the options in the second argument and the text file will be named file_name.txt PDF::Toolkit.pdftotext("file_name.pdf","-layout" )
Upvotes: 2