npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ofdconverter.js

v1.0.0

Published

通过Node.js调用Java库将ofd格式转换为目标格式

Downloads

6

Readme

说明

功能

Node.js用库,通过调用Java接口,将输入的ofd格式转换为目标格式输出。 (Java接口已包装并编译,依赖Java运行时)

特点

  • [x] 可解析任意ofd格式文件
  • [x] 可输出多种格式:pdf/png/svg/html
  • [x] 仅作中间接口,自由度高
  • [x] 即开即用 易于使用
  • [x] Java接口提供封装源码及编译后jar

原理

将Java库ofdrw-converter接口进行预先封装并编译为.jar,供Node.js调用。 Node.js利用child_process.spawn与Java接口双向通信,将输入的ofd格式传输给Java接口并接收转换后的格式并输出。

已知问题

由于Java库ofdrw-converter解析时存在缺陷,故部分格式文件转换后可能存在瑕疵。本库仅封装编译,未对底层源码做任何改动,如有转换问题请向原库反馈。

使用方法

函数(d.ts)

/**
 * 通过调用Java将输入的ofd格式转换为目标输出格式
 * @param ofdInput ofd输入流
 * @param outputType 目标输出格式,默认pdf
 * @param arg json可选参数,具体参数查阅示例或Java源码
 * @return Promise<Buffer[]>
 */
export function ofdConverter(
    ofdInput: ReadableStream | Buffer,
    outputType: 'pdf' | 'png' | 'svg' | 'html',
    arg?: { [config: string]: any }
): Promise<Buffer[]>;

安装

Java运行时

直接运行:JRE >= 8 编译修改:JDK >= 8 & Maven

###NPM

npm install ofdconverter.js

使用(Node.js)

const ofdConverter = require('ofdConverter.js');
const resultArray = await ofdConverter(ofdInpt, outputType, ?arg);

应用场景

详见示例文件

将ofd格式转换为pdf/png/svg/html格式 [ConverterAll.js]

将ofd格式先转换为png再转换为pdf格式 [OFDtoPNGtoPDF.js] (解析格式不同,输出内容可能略有差异,详见已知问题。二次转换效果可能比直接转换更好)

License

MIT