twofaz / origami-pdf

Automatically exported from code.google.com/p/origami-pdf
GNU Lesser General Public License v3.0
0 stars 0 forks source link

Setting EDITOR environment variable? #6

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Load .pdf file: pdf = PDF.read 'sample.pdf'
2. Try to edit: pdf.pages[2].edit
3. Error occured:
>>> pdf.pages[2].edit
NoMethodError: undefined method `edit' for nil:NilClass
        from (irb):2
        from C:/Ruby192/lib/ruby/gems/1.9.1/gems/origami-1.2.3/bin/pdfsh:12:in `<top (required)>'
        from C:/Ruby192/bin/pdfsh:19:in `load'
        from C:/Ruby192/bin/pdfsh:19:in `<main>'

What is the expected output? What do you see instead?
Possibility to edit page raw contents, but error occured instead.

What version of the product are you using? On what operating system?
Ruby 1.9.2-p290, Origami 1.2.3, Windows 7 Enterprise x64

Please provide any additional information below.
In GettingStarted guide said that "the EDITOR environment variable may need to 
be set up", but I don't know how to do that. I'm new to Ruby...
I tried to read all ReadMe-like files in ORIGAMI folder, but there is no 
information about setting EDITOR environment variable. Internet searh also 
doesn't help, Origami's PDF "origami-cheatsheet-1.0.0-beta2.pdf" too... I 
assuming that this feature is un-documented. :(
Can I ask for help here, please?

Thanks in advance.

Kind regards,
Stole

Original issue reported on code.google.com by condor...@gmail.com on 26 Oct 2011 at 12:30

GoogleCodeExporter commented 8 years ago
Apparently the page you try to access does not exist in the document.
The PDF#pages method returns an array of Page objects, so they are indexed from 
number 0.

If you want to reference the first page of the document, you can do either 
pdf.pages.first or pdf.pages[0]. Then if you want to access the second page, 
you have to do pdf.pages[1], and so on. pdf.pages[2] is actually referencing 
the third page.

If your document actually does have at least three pages, then this is a bug. I 
would like to get a look at the PDF file if this is the case.

Regards,
Guillaume

Original comment by guilla...@security-labs.org on 4 Nov 2011 at 2:30