views:

25

answers:

1

Hi,

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!

A: 

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" )

cswebgrl