Git Product home page Git Product logo

brava2xfdf's Introduction

xrlToXfdf

A node application to convert Brava markup files (xrl) to the xfdf format. Entry point is node-xrlToXfdf.js. It currently suppors .xod, .pdf and image files, along with the associated markup (.xrl) file.

How to install

npm install

How to build

npm run build
cd build
npm install

How to run

Option #1

For xod and pdf documents, the width and height of each page can automatically be retrieved.

node node-xrlToXfdf.js --document=sample.pdf --xrl=sample.xrl
node node-xrlToXfdf.js --document=sample.xod --xrl=sample.xrl

For other document types, the width and height cannot be automatically retrieved. You must provide the width, height.

node node-xrlToXfdf.js --xrl=sample.xrl --width=842 --height=595

Option #2 - WebViewer Server

Use WebViewer Server to automatically retrieve other documents' heights. See supported file formats here: https://www.pdftron.com/documentation/web/guides/file-format-support/

Guide on setting up your own WebViewer Server: https://www.pdftron.com/documentation/web/guides/wv-server-deployment/

node node-xrlToXfdf.js --document=sample.pdf --xrl=sample.xrl --webViewerServerUrl=https://example.server.com

Options

Port number

If not set then it defaults to 8080

node node-xrlToXfdf.js --document=sample.pdf --port=3006

Output xfdf file name

If not set then the default out.xfdf is used

node node-xrlToXfdf.js --document=sample.pdf --xrl=sample.xrl --outXfdf=out-file.xfdf

Output bookmarks file name

If not set then the default bookmarks.json is used

node node-xrlToXfdf.js --document=sample.pdf --xrl=sample.xrl --outBookmarks=myBookmarks.json

Changing Text Annotation Size

To manipulate the size of text annotations, the optional scale parameter is used.

node node-xrlToXfdf.js --document=sample.pdf --xrl=sample.xrl --scale=0.25

Changing Text Annotation Alignment

To manipulate the alignment of text in freetext annotations, the optional alignment parameter is used. Argument options = L, R, or C for Left, Right, or Center. Note: Center is used by default.

node node-xrlToXfdf.js --document=sample.pdf --xrl=sample.xrl --alignment=L

Running conversion in the browser

xrlToXfdf.min.js can be used directly used in the browser. It exposes a the function xrlToXfdf(inputXrlString, pageInfos) on the window.

inputXrlString is the contents of an .xrl markup file for annotations.

pageInfos is an array consisting of objects with the width, height and rotation of each page. Use the getPageInfo function on the document object to get the width and height. (https://www.pdftron.com/api/web/CoreControls.Document.html)

Use getPageRotation on the document object to get the page rotation in degrees.

The function will return a promise that resolves with the output xfdf string. Example:

window.xrlToXfdf('markup xrl content...', [{width: 595, height: 842, pageRotation: 0}, ...])
  .then(({ xfdf: xfdfString }) => {
    // do something here...
  });

brava2xfdf's People

Contributors

avolvesco avatar khein-pdftron avatar

Watchers

Matt Parizeau avatar sgong-pdftron avatar  avatar bfung avatar

Forkers

avolvesco

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.