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 🙏

© 2025 – Pkg Stats / Ryan Hefner

omniscript-converters

v1.2.0

Published

Format converters for OmniScript Format (OSF) - Convert OSF documents to DOCX, PPTX, XLSX, and PDF with enterprise-grade quality

Readme

OmniScript Converters

🔄 Professional Format Converters

Convert OmniScript Format (OSF) documents to PDF, DOCX, PPTX, and XLSX with enterprise-grade quality

npm version npm downloads License: MIT TypeScript

🚀 Quick Start📖 API Reference🎨 Themes💡 Examples🛠️ CLI Integration


✨ Features

📄 PDF Generation

  • High-quality PDF documents
  • Custom themes & styling
  • Vector graphics support
  • Print-optimized layouts

📝 DOCX Export

  • Native Microsoft Word format
  • Rich text formatting
  • Tables with styling
  • Document metadata

🎯 PPTX Creation

  • PowerPoint presentations
  • Automatic slide generation
  • Theme-based styling
  • Interactive layouts

📊 XLSX Conversion

  • Excel workbooks
  • Formula evaluation
  • Multiple worksheets
  • Data type preservation

🚀 Quick Start

📦 Installation

npm install omniscript-converters
# or
pnpm add omniscript-converters
# or
yarn add omniscript-converters

⚡ Basic Usage

import { parse } from 'omniscript-parser';
import { 
  PDFConverter, 
  DOCXConverter, 
  PPTXConverter, 
  XLSXConverter 
} from 'omniscript-converters';

// Parse your OSF document
const osfContent = `
@meta {
  title: "Business Report";
  author: "Jane Smith";
  theme: "Corporate";
}

@doc {
  # Executive Summary
  Our Q2 performance exceeded expectations with **15% revenue growth**.
}
`;

const document = parse(osfContent);

// Convert to PDF
const pdfConverter = new PDFConverter();
const pdfResult = await pdfConverter.convert(document, {
  theme: 'corporate',
  pageSize: 'A4'
});

// Save the result
import { writeFileSync } from 'fs';
writeFileSync('report.pdf', pdfResult.buffer);

📖 API Reference

🔧 Converter Classes

PDFConverter

const pdfConverter = new PDFConverter();
const result = await pdfConverter.convert(document, options);

Options:

  • theme: 'default' | 'corporate' | 'academic' | 'modern'
  • pageSize: 'A4' | 'letter' | 'legal'
  • orientation: 'portrait' | 'landscape'
  • margins: { top: number, right: number, bottom: number, left: number }

DOCXConverter

const docxConverter = new DOCXConverter();
const result = await docxConverter.convert(document, options);

Options:

  • theme: Theme selection for styling
  • includeMetadata: Include document metadata
  • pageSize: Page size configuration

PPTXConverter

const pptxConverter = new PPTXConverter();
const result = await pptxConverter.convert(document, options);

Options:

  • theme: Presentation theme
  • slideSize: Slide dimensions
  • autoSlides: Automatic slide generation

XLSXConverter

const xlsxConverter = new XLSXConverter();
const result = await xlsxConverter.convert(document, options);

Options:

  • sheetNames: Custom sheet naming
  • formulaEvaluation: Enable/disable formula evaluation
  • formatting: Apply cell formatting

🎨 Themes

🏢 Corporate Theme

Professional business styling with blue accents and formal typography.

{ theme: 'corporate' }

🎓 Academic Theme

Traditional academic styling with serif fonts and conservative layout.

{ theme: 'academic' }

✨ Modern Theme

Contemporary design with vibrant colors and modern typography.

{ theme: 'modern' }

📄 Default Theme

Clean, versatile styling suitable for most documents.

{ theme: 'default' }

💡 Examples

📊 Business Dashboard

import { parse } from 'omniscript-parser';
import { PDFConverter, XLSXConverter } from 'omniscript-converters';

const dashboardOSF = `
@meta {
  title: "Q2 Sales Dashboard";
  author: "Analytics Team";
  theme: "Corporate";
}

@sheet {
  name: "Regional Performance";
  cols: [Region, Q1_Sales, Q2_Sales, Growth];
  data {
    (1,1)="North America"; (1,2)=850000; (1,3)=975000;
    (2,1)="Europe"; (2,2)=650000; (2,3)=748000;
    (3,1)="Asia Pacific"; (3,2)=400000; (3,3)=477000;
  }
  formula (1,4): "=(C1-B1)/B1*100";
  formula (2,4): "=(C2-B2)/B2*100";
  formula (3,4): "=(C3-B3)/B3*100";
}

@doc {
  # Sales Analysis Summary
  
  Our Q2 results show strong performance across all regions:
  
  - **North America**: 14.7% growth
  - **Europe**: 15.1% growth  
  - **Asia Pacific**: 19.3% growth
}
`;

const document = parse(dashboardOSF);

// Generate PDF report
const pdfConverter = new PDFConverter();
const pdfReport = await pdfConverter.convert(document, {
  theme: 'corporate',
  pageSize: 'A4'
});

// Generate Excel workbook
const xlsxConverter = new XLSXConverter();
const xlsxReport = await xlsxConverter.convert(document, {
  formulaEvaluation: true
});

// Save both formats
writeFileSync('dashboard.pdf', pdfReport.buffer);
writeFileSync('dashboard.xlsx', xlsxReport.buffer);

🎯 Presentation Creation

const presentationOSF = `
@meta {
  title: "Product Launch 2025";
  author: "Product Team";
  theme: "Modern";
}

@slide {
  title: "Introducing OmniScript";
  layout: "TitleAndContent";
  content: "The future of document processing is here.";
}

@slide {
  title: "Key Features";
  layout: "TitleAndBullets";
  bullets {
    "🚀 Universal document format";
    "🤖 AI-native syntax design";
    "🔄 Git-friendly version control";
    "📊 Multi-format export capabilities";
  }
}
`;

const document = parse(presentationOSF);
const pptxConverter = new PPTXConverter();
const presentation = await pptxConverter.convert(document, {
  theme: 'modern',
  slideSize: 'widescreen'
});

writeFileSync('product-launch.pptx', presentation.buffer);

🛠️ CLI Integration

The converters are seamlessly integrated with the OmniScript CLI:

# Generate PDF with corporate theme
osf render document.osf --format pdf --output report.pdf --theme corporate

# Create PowerPoint presentation
osf render slides.osf --format pptx --output presentation.pptx --theme modern

# Generate Excel workbook with formulas
osf render data.osf --format xlsx --output spreadsheet.xlsx

# Convert to Word document
osf render document.osf --format docx --output document.docx --theme academic

📋 CLI Options

| Option | Description | Values | |--------|-------------|--------| | --format | Output format | pdf, docx, pptx, xlsx | | --theme | Visual theme | default, corporate, academic, modern | | --output | Output file path | Any valid file path | | --page-size | Page size (PDF/DOCX) | A4, letter, legal | | --orientation | Page orientation | portrait, landscape |


🔧 Advanced Configuration

Custom Styling

const customOptions = {
  theme: 'corporate',
  pageSize: 'A4',
  orientation: 'portrait',
  margins: {
    top: 1,      // inches
    right: 1,
    bottom: 1,
    left: 1
  },
  fonts: {
    heading: 'Arial Bold',
    body: 'Arial',
    monospace: 'Courier New'
  },
  colors: {
    primary: '#2563eb',
    secondary: '#64748b',
    accent: '#f59e0b'
  }
};

const result = await pdfConverter.convert(document, customOptions);

Batch Processing

import { glob } from 'glob';

// Convert all OSF files in a directory
const osfFiles = await glob('documents/*.osf');
const pdfConverter = new PDFConverter();

for (const file of osfFiles) {
  const content = readFileSync(file, 'utf-8');
  const document = parse(content);
  const result = await pdfConverter.convert(document, { theme: 'corporate' });
  
  const outputPath = file.replace('.osf', '.pdf');
  writeFileSync(outputPath, result.buffer);
  console.log(`✅ Converted ${file} → ${outputPath}`);
}

📊 Supported Features

| Feature | PDF | DOCX | PPTX | XLSX | |---------|-----|------|------|------| | Text Formatting | ✅ | ✅ | ✅ | ✅ | | Tables | ✅ | ✅ | ✅ | ✅ | | Formulas | ❌ | ❌ | ❌ | ✅ | | Images | ✅ | ✅ | ✅ | ✅ | | Themes | ✅ | ✅ | ✅ | ⚠️ | | Metadata | ✅ | ✅ | ✅ | ✅ | | Headers/Footers | ✅ | ✅ | ❌ | ❌ | | Page Breaks | ✅ | ✅ | N/A | N/A |

Legend: ✅ Full Support • ⚠️ Partial Support • ❌ Not Applicable


🛡️ Error Handling

try {
  const result = await pdfConverter.convert(document, options);
  console.log('✅ Conversion successful');
} catch (error) {
  if (error instanceof ConversionError) {
    console.error('❌ Conversion failed:', error.message);
    console.error('Details:', error.details);
  } else {
    console.error('❌ Unexpected error:', error);
  }
}

Common Error Types

  • ParseError: Invalid OSF syntax
  • ConversionError: Format conversion issues
  • ThemeError: Invalid theme configuration
  • FileSystemError: File I/O problems

🔧 Development

Setup

# Clone the repository
git clone https://github.com/OmniScriptOSF/omniscript-converters.git
cd omniscript-converters

# Install dependencies
pnpm install

# Build the package
pnpm run build

# Run tests
pnpm test

# Run test conversion
pnpm run test:convert

Testing

# Run all tests
pnpm test

# Run specific converter tests
pnpm test pdf
pnpm test docx
pnpm test pptx
pnpm test xlsx

# Generate test reports
pnpm run test:coverage

🤝 Contributing

We welcome contributions! Please see our Contributing Guide.

🌟 Areas for Contribution

  • 🎨 New Themes - Design beautiful new visual themes
  • 📊 Chart Support - Add chart rendering capabilities
  • 🔧 Performance - Optimize conversion speed and memory usage
  • 🧪 Testing - Expand test coverage and edge cases
  • 📖 Documentation - Improve examples and guides

📄 License

MIT License © 2025 Alphin Tom


🔗 Related Packages


📞 Support


🚀 Ready to convert your OSF documents?

📦 Install Now📖 View Examples🤝 Get Support


Built with ❤️ for professional document workflows