Comments (5)
Sorry for my absence, and I'm glad you were able to find a workaround. As of the latest version, 2.1.0, docx files can be converted by specifying the file path as an array:
PandocRuby.new(['/path/to/example.docx'], from: 'docx', to: 'html').convert
Please let me know if you run into additional issues related to this!
from pandoc-ruby.
This is a problem in Pandoc itself:
It is fixed in Pandoc 2.0.x. Just upgrade your Pandoc binary and it'll work.
from pandoc-ruby.
gem 'pandoc-ruby', '2.0.2'
same error raising RuntimeError: pandoc: Cannot read archive from stdin
from pandoc-ruby.
@agiratech-reddysai - pandoc-ruby is just a wrapper gem around a system call, i.e. it runs the pandoc(1) binary on your system, so what matters is what version of pandoc is installed. Try running pandoc --version
from the command line, and upgrade pandoc, not pandoc-ruby, if necessary.
from pandoc-ruby.
I'm running pandoc 2.2.1 and pandoc-ruby 2.0.2 and I'm having trouble getting a docx to convert to html as well (although obviously for a different reason).
The command line works. I'm using example_29.docx from the pandoc demos. Running docker-compose exec web pandoc -f docx -t html tmp/example29.docx
yields
<h1 id="synopsis">Synopsis</h1>
<p><code>pandoc</code> [<em>options</em>] [<em>input-file</em>]…</p>
<h1 id="description">Description</h1>
<p>Pandoc is a <a href="https://www.haskell.org">Haskell</a> library for converting from one markup format to another, and a command-line tool that uses this library.</p>
...
From the console however:
irb(main):001:0> PandocRuby
=> PandocRuby
irb(main):002:0> PandocRuby.convert("tmp/example29.docx", from: :docx, to: :html)
Traceback (most recent call last):
1: from (irb):2
RuntimeError (couldn't parse docx file)
Update!
Ok, so I got it working, but there's some interesting behaviour.
PandocRuby.convert("tmp/example29.docx", from: :docx, to: :html)
doesn't work, because that string isn't a valid docx file. File.open
will create a ruby file object and isn't valid to feed into the convert
method. But IO::read
works:
PandocRuby.convert(IO::read("tmp/import_processing_example29.docx"), from: :docx, to: :html)
However, this doesn't:
@converter = PandocRuby.new
@converter.convert(IO::read("tmp/import_processing_example29.docx"), from: :docx, to: :html)
ArgumentError: invalid byte sequence in UTF-8
I don't need that to work, but given info in the readme, it seems that it should. Any idea what's happening there?
from pandoc-ruby.
Related Issues (20)
- How to pass Stack Size Parameter in convert()? HOT 2
- Support for Pandoc "extensions"? HOT 2
- Hyphen stripped from options
- Providing nil for `input_string` to convert will cause a time out HOT 1
- Fails if there are spaces in the outfile HOT 2
- Pandoc deprecated --chapter in favor of --top-level-division=chapter HOT 1
- miss.. HOT 1
- It is not compatible with Pandoc's new way of adding/removing extensions HOT 1
- DOCX to HTML HOT 1
- Images failing when convert happens asynchronously HOT 1
- Improper handling of DOC file HOT 1
- Using Pathname objects for file arguments is broken in 2.1.2 and 2.1.3 HOT 4
- Outvar and context errors when used in Middleman (Patch included) HOT 2
- Test suite failures HOT 2
- I need to know what's PandocRuby's path to pandoc
- BUG: after last update get error. HOT 2
- Textile text block with trailing space not converted only when using `pandoc-ruby` HOT 1
- Input file names with spaces are not quoted HOT 1
- syntax error, unexpected keyword_rescue, expecting keyword_end HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pandoc-ruby.