README.md in br_danfe-0.0.1 vs README.md in br_danfe-0.0.2

- old
+ new

@@ -4,31 +4,22 @@ This gem generates PDF files for Brazilian DANFE (_Documento Auxiliar da Nota Fiscal Eletrônica_) from a valid NF-e XML. This gem requires `ruby >= 1.9.x`. -It's a fork of [Ruby DANFE](http://github.com/taxweb/ruby_danfe) project. - -The difference is that this project doesn't support DACTE (_Documento Auxiliar do Conhecimento de Transporte Eletrônico_) or NFC-e (_Nota Fiscal do Consumidor Eletrônica_). It's only focused on DANFE. - ## Installing gem install ruby_danfe ## Usage -If you have the xml saved in a file: + xml = File.read("nfe.xml") - require "br_danfe" - BrDanfe.generate("sample.pdf", "sample.xml") + danfe = BrDanfe::Danfe.new(xml) + danfe.options.logo_path = "logo.png" + danfe.save_pdf("nfe.pdf") -If you have the xml in a variable: - - xml = BrDanfe::XML.new(my_xml_string) - pdf = BrDanfe.generatePDF(xml) - pdf.render_file "output.pdf" - ## I18n By default, your rails application must be configured to `pt-Br`. If you need to customize some message or field label, you can override the content of pt-Br.yml file. @@ -50,31 +41,18 @@ $ rake pdf_from["spec/fixtures/nfe_with_ns.xml","./output.pdf"] You can also use an special version of irb with all classes pre-loaded. Just use: $ rake console - I18n.locale = "pt-BR" - BrDanfe.generate("output.pdf", "test/nfe_with_ns.xml") -or - - $ rake console - I18n.locale = "pt-BR" - my_xml_string = "" - file = File.new("test/nfe_with_ns.xml", "r") - while (line = file.gets) - my_xml_string = my_xml_string + line - end - file.close + xml = File.read "test/nfe_with_ns.xml" - xml = BrDanfe::XML.new(my_xml_string) - pdf = BrDanfe.generatePDF(xml) + danfe = BrDanfe::Danfe.new(xml) + danfe.save_pdf "output.pdf" - pdf.render_file "output.pdf" - #### Automated tests with RSpec You can run all specs using: $ rspec @@ -108,9 +86,13 @@ 1. Fork it 2. Create your feature branch (`git checkout -b my-new-feature`) 3. Commit your changes (`git commit -am 'Add some feature'`) 4. Push to the branch (`git push origin my-new-feature`) 5. Create new Pull Request + +## Ruby DANFE gem + +This project is based on [Ruby DANFE gem](http://github.com/taxweb/ruby_danfe). ## License BrDanfe is released under the [MIT License](http://www.opensource.org/licenses/MIT).