Skip to content

yeslogic/prince-macos-ui

Repository files navigation

PrinceUI

A native macOS application for converting HTML to PDF using the Prince HTML to PDF converter.

Overview

PrinceUI provides an intuitive, Mac-native interface for Prince, making it easy to convert HTML documents to high-quality PDF files. Instead of using the command line, you can drag and drop HTML files, adjust settings visually, and see conversion progress in real-time.

Features

Conversion

  • Drag & Drop: Drop HTML files directly onto the app
  • File Picker: Browse for HTML files to convert
  • Progress Tracking: Real-time progress indication
  • Auto-open: Optionally open PDFs automatically after conversion
  • Conversion Logging: View detailed output from Prince

Quick Settings

  • Paper size (A4, Letter, Legal, A3, A5, Tabloid)
  • Page orientation (Portrait, Landscape)

Advanced Settings

  • JavaScript: Enable/disable JavaScript execution in HTML
  • PDF Profiles: Comprehensive support for PDF/A, PDF/X, and PDF/UA standards
  • Font Embedding: Control whether fonts are embedded in the PDF
  • Font Subsetting: Reduce file size by including only used characters
  • Tagged PDF: Generate accessible PDFs with structure tags
  • Compression: Enable/disable PDF compression
  • PDF Metadata: Set document title, author, subject, and keywords
  • Encryption: Encrypt PDFs with optional password protection
  • PDF Permissions: Control printing, copying, modifying, and annotations

Other Features

  • Auto-detect Prince installation
  • Custom Prince executable path
  • Default output location
  • Persistent settings

Requirements

  • macOS: 14.0 (Sonoma) or later
  • Prince: Prince HTML to PDF converter must be installed

Note: PrinceUI works on both Intel and Apple Silicon Macs running macOS 14+.

Installation

Installing Prince

If you haven't installed Prince yet:

# Using Homebrew (recommended)
brew install --cask prince

# Verify installation
prince --version

Installing PrinceUI

  1. Download PrinceUI.app
  2. Move to /Applications
  3. Double-click to launch
  4. If you see a security warning, right-click and select "Open"

Usage

Basic Conversion

  1. Launch PrinceUI
  2. Drag an HTML file onto the input area (or click to browse)
  3. Choose where to save the PDF (or use default location)
  4. Adjust paper size and orientation if needed
  5. Click "Convert to PDF"
  6. View progress and status

Viewing Logs

After a conversion:

  • Click "Show Conversion Log" to see:
    • Full Prince command executed
    • Standard output from Prince
    • Any warnings or messages
    • Timestamps and file paths

Settings

Access settings via:

  • Menu: PrinceUI → Settings (⌘,)
  • Main Window: Click "More Settings..." link

General Tab

  • Prince Installation: Auto-detect or manually set Prince path
  • Default Settings: Set default paper size and orientation
  • Output: Choose default output location and auto-open behavior

PDF Options Tab

  • JavaScript: Enable/disable JavaScript execution
  • PDF Generation:
    • Choose PDF profile from 16 options (PDF/A, PDF/X, PDF/UA, combined profiles)
    • Embed fonts in the PDF
    • Subset fonts to reduce file size
    • Tagged PDF for accessibility
    • PDF compression
  • PDF Metadata:
    • Set document title
    • Set document author
    • Set document subject
    • Add keywords for searchability
  • PDF Encryption:
    • Enable encryption (passwords optional)
    • Set user password (restricts opening)
    • Set owner password (controls permissions)
    • Control PDF permissions:
      • Allow/disallow printing
      • Allow/disallow copying text and images
      • Allow/disallow modifying document
      • Allow/disallow annotations and form filling

FAQ

Where does PrinceUI save converted PDFs?

By default, PDFs are saved next to the input HTML file with a .pdf extension. You can:

  • Choose a different location for each conversion
  • Set a default output location in Settings

What PDF profiles are supported?

PrinceUI supports 16 PDF profiles:

Archival (PDF/A):

  • PDF/A-1a, PDF/A-1b - ISO 19005-1 (2005)
  • PDF/A-2a, PDF/A-2b - ISO 19005-2 (2011)
  • PDF/A-3a, PDF/A-3b - ISO 19005-3 (2012, supports attachments)

Accessibility (PDF/UA):

  • PDF/UA-1 - ISO 14289-1 (Universal Accessibility)

Print Production (PDF/X):

  • PDF/X-1a:2001, PDF/X-1a:2003 - Basic print production
  • PDF/X-3:2002, PDF/X-3:2003 - Print with color management
  • PDF/X-4 - Modern print production (supports transparency)

Combined Profiles (Archival + Accessibility):

  • PDF/A-1a+PDF/UA-1
  • PDF/A-2a+PDF/UA-1
  • PDF/A-3a+PDF/UA-1

Default: Prince chooses the appropriate PDF version automatically based on features used

How do I encrypt a PDF?

  1. Open Settings → PDF Options
  2. Enable "Encrypt PDF"
  3. Optionally set passwords:
    • User Password: Restricts opening the PDF
    • Owner Password: Controls who can change permissions
  4. Set permissions (printing, copying, modifying, annotations)
  5. Convert your HTML file

Note: Passwords are optional. Without passwords, the PDF is encrypted but can be opened by anyone, while permissions still apply.

Can I convert multiple files at once?

Not yet - batch conversion is planned for a future update.

What HTML features does Prince support?

Prince supports modern HTML5 and CSS3. For detailed information, see: https://www.princexml.com/doc/

Why isn't Prince found automatically?

PrinceUI checks these locations:

  1. /opt/homebrew/bin/prince (Homebrew on Apple Silicon)
  2. /usr/local/bin/prince (Homebrew on Intel)
  3. /usr/bin/prince (System installation)

If Prince is installed elsewhere:

  1. Open Settings → General
  2. Click "Browse..." next to Prince executable path
  3. Navigate to your Prince installation

Or click "Auto-detect" to search common locations again.

Can I use custom CSS with my HTML?

Not directly in the UI yet. For now, you can:

  • Include CSS in your HTML file using <link> or <style> tags
  • Use Prince CSS extensions in your stylesheets
  • Future versions may add a custom CSS file option

Does this work with external resources (images, fonts)?

Yes, Prince can load:

  • Local images and resources referenced in your HTML
  • External resources via HTTP/HTTPS (if JavaScript is enabled)
  • Web fonts (@font-face)

Where are my settings stored?

Settings are stored in:

~/Library/Preferences/com.princexml.PrinceUI.plist

To reset all settings:

defaults delete com.princexml.PrinceUI

Troubleshooting

"Prince executable not found"

Solution:

  1. Install Prince: brew install --cask prince
  2. Or click "Auto-detect" in Settings
  3. Or manually set the path in Settings → General

"Conversion failed with exit code 1"

Solutions:

  1. Click "Show Conversion Log" to see the error
  2. Check that your HTML file is valid
  3. Verify all referenced resources (images, CSS) exist
  4. Check Settings → PDF Options for incompatible options

The app won't open

Solutions:

  1. Right-click PrinceUI.app → Open (for first launch)
  2. Check System Settings → Privacy & Security
  3. Make sure you're running macOS 13.0 or later

Conversion is slow

Possible causes:

  • Large HTML files
  • Many external resources
  • Complex CSS layouts
  • Large images that need processing

Tips:

  • Use local resources instead of fetching from the web
  • Optimize images before conversion
  • Simplify CSS if possible

PDF doesn't look right

Solutions:

  1. Verify your HTML renders correctly in a browser
  2. Check for Prince-specific CSS you might need
  3. Try different PDF profiles
  4. Consult Prince documentation for CSS support
  5. Check conversion log for warnings

Keyboard Shortcuts

  • ⌘, - Open Settings
  • ⌘Q - Quit PrinceUI

Privacy

PrinceUI:

  • Does not collect any data
  • Does not send information over the network
  • Only accesses files you explicitly select
  • Stores preferences locally on your Mac

Support

For issues with:

License

PrinceUI is provided by YesLogic Pty. Ltd.

Prince itself requires a separate license:

Credits

  • Prince HTML to PDF: YesLogic Pty. Ltd.
  • PrinceUI: Native macOS interface for Prince
  • Built with Swift and SwiftUI

Version History

Version 1.0

  • Initial release
  • Drag & drop HTML conversion
  • Real-time progress tracking with Prince structured logging
  • Comprehensive PDF configuration:
    • 16 PDF profiles (PDF/A, PDF/X, PDF/UA, combined profiles)
    • Font embedding and subsetting
    • PDF metadata (title, author, subject, keywords)
    • Encryption with optional passwords
    • Granular permissions control
  • Conversion logging with full command details
  • Auto-detect Prince installation
  • Native macOS interface built with SwiftUI
  • Swift 6 concurrency compliant

Future Enhancements

Potential features for future releases:

  • Batch conversion (multiple files)
  • Conversion presets (saved configurations)
  • Recent files list
  • Custom CSS file attachment (--style)
  • Custom JavaScript file attachment (--script)
  • Base URL configuration (--baseurl)
  • Network access controls (--no-network)
  • iframe processing (--iframes)
  • Advanced margin settings (--page-margin)
  • Color conversion for print (--convert-colors)

Visit Prince: https://www.princexml.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published