Skip to content

Instantly share code, notes, and snippets.

@dentarg
Last active February 20, 2016 11:10
Show Gist options
  • Save dentarg/4655667 to your computer and use it in GitHub Desktop.
Save dentarg/4655667 to your computer and use it in GitHub Desktop.
nokogiri-java bug
# A sample Gemfile
source "https://rubygems.org"
gem "nokogiri"
GEM
remote: https://rubygems.org/
specs:
nokogiri (1.6.7.2-java)
PLATFORMS
java
DEPENDENCIES
nokogiri
BUNDLED WITH
1.11.2
# encoding: utf-8
require File.join(File.dirname(__FILE__), 'iText-4.2.0')
java_import 'com.lowagie.text.pdf.AcroFields'
java_import 'com.lowagie.text.pdf.PdfArray'
java_import 'com.lowagie.text.pdf.PdfDictionary'
java_import 'com.lowagie.text.pdf.PdfName'
java_import 'com.lowagie.text.pdf.PdfObject'
java_import 'com.lowagie.text.pdf.PdfReader'
java_import 'com.lowagie.text.pdf.PdfStamper'
java_import 'com.lowagie.text.pdf.PdfStream'
java_import 'com.lowagie.text.pdf.PdfWriter'
java_import 'com.lowagie.text.pdf.XfaForm'
java_import 'com.lowagie.text.pdf.XfdfReader'
pdf_name = 'test_template.pdf'
out_stream = java.io.ByteArrayOutputStream.new
reader = PdfReader.new(pdf_name)
stamper = PdfStamper.new(reader, out_stream)
afields = stamper.getAcroFields
xfa = afields.getXfa
dom = xfa.getDomDocument
File.open('dom', 'w').write Marshal.dump(dom)
This file has been truncated, but you can view the full file.
View raw

(Sorry about that, but we can’t show files that are this big right now.)

Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment