cytoscape / cytoscape.js-pdf-export

PDF export extension for Cytoscape.js
MIT License
0 stars 0 forks source link

cytoscape.js-pdf-export

Cytoscape.js extension for exporting networks to PDF (using PDFkit).

License

MIT

Dependencies

How to use

Installation

Importing

import cytoscape from 'cytoscape';
import pdf from 'cytoscape-pdf-export';

cytoscape.use(pdf);

Using

const blobPromise = cy.pdf({
  paperSize: 'LETTER',
  orientation: 'LANDSCAPE',
});
const blob = await blobPromise;
saveAs(blob, 'network.pdf', true);

Options

const options = {
  // If false then only the visible part of the network will be exported.
  // If true then the entire network is exported regardless of the current zoom/pan.
  full: false, 

  // The background color to use, or none if false. 
  // Can be any CSS color value that's accepted by Cytoscape.js
  bg: false,

  // The paper size, see below for accepted values for these options.
  paperSize: 'LETTER', 
  orientation: 'PORTRAIT',

  // The width/height to use when the paperSize is set to 'CUSTOM'
  width: null,  // paper width  in "PostScript points", 72 units per inch
  height: null, // paper height in "PostScript points", 72 units per inch

  // The margin, default is 52 units which represents 3/4 of an inch.
  margin: 52,

  // There is limited support for the cytoscape-layers extension.
  // If this flag is true then any SVG layers registered with the cytoscape-layers 
  // extension will be included in the PDF export.
  includeSvgLayers: false,

  // If true will log debug info to the console.
  debug: false, 

  // The options below are temporary and will be removed in the future.
  save: false, // causes a save-as window to pop up when the PDF is ready to be downloaded 
  fileName: 'cytoscape.pdf', 
};

Fonts

Reporting Bugs

Known Limitations