View on GitHub

PDF-To-Cairo-raku

Some experimental PDF rendering to Cairo

[Raku PDF Project] / PDF::To::Cairo

PDF::To::Cairo

Example

To burst my.pdf to PNG images my-001.png my-002.png

Via the shell

bin/pdf2image.raku my.pdf

Via Raku

use PDF::Class;
use PDF::To::Cairo;

my PDF::Class $pdf .= open: "my.pdf";
my $outfile-templ = "my-%03d.png";

PDF::To::Cairo.save-as($pdf, $outfile-templ);

Description

This module is an experimental work-in-progress PDF rendering via Cairo and the Raku PDF Tool-chain. It is able to render from PDF::Class or PDF::API6 objects. Supported output formats are PNG, PDF (round trip) and SVG.

This module can currently render text (most fonts), simple colors, tiling patterns and basic graphics.

At this stage its main purpose is to exercise Raku modules related to PDF, fonts and rendering, including:

Scripts

pdf2image.raku --page=n --batch=m --trace --password=*** <in>.pdf [out-fmt]

Where

pdf2image.raku Options

pdf-previews.raku <directory> --previews=<directory>

Render all PDF files in a given input directory (default .) and render PNG previews to a given output directory; by default to a .previews subdirectory in the input directory.

Status

Implemented:

Nyi: