Giter Site home page Giter Site logo

ofdparser's Introduction

ofdparser

OFD电子发票验签、发票信息提取、保存为图片。

创建文档

OFDInfo ofdInfo = OfdParser.parser(new File("/path/to/test.ofd"));

验签

ofdInfo.verify()

发票信息提取

ofdInfo.getInvoice()

保存为图片

OFDPainter ofdPainter = ofdInfo.getOfdPainter();

// 保存为一张图片
BufferedImage image = ofdPainter.convertAsSingleImage(150);
ImageIO.write(image, "JPG", new File(fileName + "-image-0-single" + ".jpg"));

// 保存为多张图片(一页一张图片)
List<BufferedImage> images = ofdPainter.convertAsImages(150);
for (int i = 0; i < images.size(); i++) {
    ImageIO.write(images.get(i), "JPG", new File(fileName + "-image-" + (i + 1) + ".jpg"));
}

保存为SVG矢量图

OFDPainter ofdPainter = ofdInfo.getOfdPainter();

// 保存为一张SVG
SVGGraphics2D svg = ofdPainter.convertAsSingleSVG(150);
svg.stream(new FileWriter(fileName + "-svg-0-single" + ".svg"));

// 保存为多张图片(一页一个SVG)
List<SVGGraphics2D> svgs = ofdPainter.convertAsSVGs(150);
for (int i = 0; i < svgs.size(); i++) {
    svgs.get(i).stream(new FileWriter(fileName + "-svg-" + (i + 1) + ".svg"));
}

ofdparser's People

Contributors

gongdaowen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.