From f09922076fb35827309bd884b8212bc52ab23c92 Mon Sep 17 00:00:00 2001 From: reugenio Date: Tue, 9 Dec 2025 02:10:57 +0100 Subject: [PATCH] refactor: Rename zpdf to zcatpdf for consistency with zcat* family MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Renamed all references from zpdf to zcatpdf - Module import: @import("zcatpdf") - Consistent with zcatui, zcatgui naming convention - All lowercase per Zig standards Note: Directory rename (zpdf -> zcatpdf) and Forgejo repo rename should be done manually after this commit. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- CLAUDE.md | 26 ++++++------ FUTURE_IMPROVEMENTS.md | 12 +++--- IMPLEMENTATION_PLAN.md | 26 ++++++------ README.md | 72 +++++++++++++++++----------------- build.zig | 8 ++-- examples/barcode_demo.zig | 14 +++---- examples/bookmarks_demo.zig | 20 +++++----- examples/curves_demo.zig | 12 +++--- examples/gradient_demo.zig | 14 +++---- examples/hello.zig | 10 ++--- examples/image_demo.zig | 8 ++-- examples/invoice.zig | 4 +- examples/links_demo.zig | 10 ++--- examples/markdown_demo.zig | 28 ++++++------- examples/pagination_demo.zig | 8 ++-- examples/table_demo.zig | 8 ++-- examples/template_demo.zig | 20 +++++----- examples/text_demo.zig | 10 ++--- examples/transforms_demo.zig | 12 +++--- examples/transparency_demo.zig | 10 ++--- examples/ttf_demo.zig | 10 ++--- src/compression/mod.zig | 2 +- src/compression/zlib.zig | 2 +- src/images/mod.zig | 2 +- src/output/producer.zig | 2 +- src/pdf.zig | 2 +- src/root.zig | 24 ++++++------ 27 files changed, 188 insertions(+), 188 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 9e5183a..2d4711d 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,4 +1,4 @@ -# zpdf - Generador PDF para Zig +# zcatpdf - Generador PDF para Zig > **Ultima actualizacion**: 2025-12-09 > **Lenguaje**: Zig 0.15.2 @@ -7,7 +7,7 @@ ## Descripcion del Proyecto -**zpdf** es una libreria pura Zig para generacion de documentos PDF. Compila a un binario unico con minimas dependencias. +**zcatpdf** es una libreria pura Zig para generacion de documentos PDF. Compila a un binario unico con minimas dependencias. **Filosofia**: - Minimas dependencias (libdeflate para compresion) @@ -176,7 +176,7 @@ ## Arquitectura ``` -zpdf/ +zcatpdf/ ├── CLAUDE.md # Documentacion del proyecto ├── build.zig # Sistema de build ├── src/ @@ -252,9 +252,9 @@ zpdf/ ### Documento Basico ```zig -const zpdf = @import("zpdf"); +const zcatpdf = @import("zcatpdf"); -var doc = zpdf.Pdf.init(allocator, .{}); +var doc = zcatpdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Mi Documento"); @@ -270,14 +270,14 @@ try doc.save("output.pdf"); ```zig // cell() simple -try page.cell(100, 20, "Hello", zpdf.Border.all, .center, true); +try page.cell(100, 20, "Hello", zcatpdf.Border.all, .center, true); // multiCell con word wrap -try page.multiCell(400, null, texto_largo, zpdf.Border.none, .left, false); +try page.multiCell(400, null, texto_largo, zcatpdf.Border.none, .left, false); // Table helper const widths = [_]f32{ 200, 100, 100 }; -var table = zpdf.Table.init(page, .{ +var table = zcatpdf.Table.init(page, .{ .col_widths = &widths, }); try table.header(&.{ "Producto", "Qty", "Precio" }); @@ -371,7 +371,7 @@ try page.drawCode128(x, y, "ABC-12345", 50, 1.5); // height=50, module_width=1. try page.drawCode128WithText(x, y, "ABC-12345", 50, 1.5, true); // QR Code 2D barcode -try page.drawQRCode(x, y, "HTTPS://GITHUB.COM", 100, zpdf.QRCode.ErrorCorrection.M); +try page.drawQRCode(x, y, "HTTPS://GITHUB.COM", 100, zcatpdf.QRCode.ErrorCorrection.M); // Error correction levels: // .L - Low (7% recovery) @@ -434,13 +434,13 @@ try page.addInternalLink(2, 100, 700, 150, 20); // page 2 ```zig // Numeros de pagina -try zpdf.Pagination.addPageNumbers(&doc, .{ +try zcatpdf.Pagination.addPageNumbers(&doc, .{ .format = "Page {PAGE} of {PAGES}", .position = .bottom_center, }); // Header con linea -try zpdf.addHeader(&doc, "Documento", .{ +try zcatpdf.addHeader(&doc, "Documento", .{ .draw_line = true, }); ``` @@ -748,10 +748,10 @@ $ZIG build test ``` /mnt/cello2/arno/re/recode/TEAM_STANDARDS/ -git remote: git@git.reugenio.com:reugenio/zpdf.git +git remote: git@git.reugenio.com:reugenio/zcatpdf.git ``` --- -**zpdf - Generador PDF para Zig** +**zcatpdf - Generador PDF para Zig** *v1.0 - RELEASE (FEATURE COMPLETE) - 2025-12-09* diff --git a/FUTURE_IMPROVEMENTS.md b/FUTURE_IMPROVEMENTS.md index c85880b..c01caa4 100644 --- a/FUTURE_IMPROVEMENTS.md +++ b/FUTURE_IMPROVEMENTS.md @@ -1,6 +1,6 @@ -# zpdf - Mejoras Futuras +# zcatpdf - Mejoras Futuras -> Este documento detalla las posibles mejoras y funcionalidades que podrían implementarse en versiones futuras de zpdf. +> Este documento detalla las posibles mejoras y funcionalidades que podrían implementarse en versiones futuras de zcatpdf. > Fecha: 2025-12-09 > Versión actual: v1.0 @@ -104,7 +104,7 @@ El módulo `src/security/` tiene implementado: ### Código de ejemplo (objetivo) ```zig -var pdf = zpdf.Pdf.init(allocator, .{}); +var pdf = zcatpdf.Pdf.init(allocator, .{}); pdf.setEncryption(.{ .user_password = "user123", .owner_password = "admin456", @@ -179,7 +179,7 @@ El módulo `src/forms/field.zig` define: ### Código de ejemplo (objetivo) ```zig -var pdf = zpdf.Pdf.init(allocator, .{}); +var pdf = zcatpdf.Pdf.init(allocator, .{}); var page = try pdf.addPage(.{}); try page.addTextField(.{ @@ -426,7 +426,7 @@ Si se retoma el desarrollo, este es el orden sugerido: - [CommonMark Spec](https://spec.commonmark.org/) ### Librerías de referencia -- [fpdf2 (Python)](https://github.com/py-pdf/fpdf2) - Base de inspiración para zpdf +- [fpdf2 (Python)](https://github.com/py-pdf/fpdf2) - Base de inspiración para zcatpdf - [pdf-lib (JavaScript)](https://github.com/Hopding/pdf-lib) - Buena referencia para features - [pdfkit (Node.js)](https://github.com/foliojs/pdfkit) - Implementación madura @@ -438,4 +438,4 @@ Si se retoma el desarrollo, este es el orden sugerido: --- *Documento generado: 2025-12-09* -*zpdf v1.0 - Feature Complete* +*zcatpdf v1.0 - Feature Complete* diff --git a/IMPLEMENTATION_PLAN.md b/IMPLEMENTATION_PLAN.md index 9693a4e..bab6c4e 100644 --- a/IMPLEMENTATION_PLAN.md +++ b/IMPLEMENTATION_PLAN.md @@ -1,4 +1,4 @@ -# zpdf - Plan de Implementacion Completo +# zcatpdf - Plan de Implementacion Completo > **Creado**: 2025-12-08 > **Version actual**: 0.5 @@ -273,7 +273,7 @@ test "parse RGBA PNG with alpha" { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -630,7 +630,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -859,7 +859,7 @@ pub const Pdf = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -1082,7 +1082,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -1234,7 +1234,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -1420,7 +1420,7 @@ for (page.ext_gstates, 0..) |gs, i| { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -1641,7 +1641,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -1864,7 +1864,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -1895,7 +1895,7 @@ pub fn main() !void { // QR con mas datos try page.drawText(300, 600, "QR Code (mas datos):"); - try page.drawQrCode(300, 450, "Hola mundo! Este es un ejemplo de QR Code generado con zpdf", .{ + try page.drawQrCode(300, 450, "Hola mundo! Este es un ejemplo de QR Code generado con zcatpdf", .{ .module_size = 3, .ecc = .H, }); @@ -2007,7 +2007,7 @@ pub const OutputProducer = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -2199,7 +2199,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -2616,7 +2616,7 @@ pub const Page = struct { ```zig const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; diff --git a/README.md b/README.md index 214593c..2ed0d6d 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# zpdf - PDF Generation Library for Zig +# zcatpdf - PDF Generation Library for Zig A pure Zig library for creating PDF documents with minimal dependencies. ```zig -const zpdf = @import("zpdf"); +const zcatpdf = @import("zcatpdf"); pub fn main() !void { - var pdf = zpdf.Pdf.init(allocator, .{}); + var pdf = zcatpdf.Pdf.init(allocator, .{}); defer pdf.deinit(); var page = try pdf.addPage(.{}); @@ -35,12 +35,12 @@ pub fn main() !void { ## Installation -Add zpdf to your `build.zig.zon`: +Add zcatpdf to your `build.zig.zon`: ```zig .dependencies = .{ - .zpdf = .{ - .url = "https://git.reugenio.com/reugenio/zpdf/archive/v1.0.tar.gz", + .zcatpdf = .{ + .url = "https://git.reugenio.com/reugenio/zcatpdf/archive/v1.0.tar.gz", .hash = "...", }, }, @@ -49,11 +49,11 @@ Add zpdf to your `build.zig.zon`: In your `build.zig`: ```zig -const zpdf_dep = b.dependency("zpdf", .{ +const zcatpdf_dep = b.dependency("zcatpdf", .{ .target = target, .optimize = optimize, }); -exe.root_module.addImport("zpdf", zpdf_dep.module("zpdf")); +exe.root_module.addImport("zcatpdf", zcatpdf_dep.module("zcatpdf")); ``` ## Quick Reference @@ -85,14 +85,14 @@ exe.root_module.addImport("zpdf", zpdf_dep.module("zpdf")); **File:** `src/pdf.zig` ```zig -const zpdf = @import("zpdf"); +const zcatpdf = @import("zcatpdf"); // Create document with default settings -var pdf = zpdf.Pdf.init(allocator, .{}); +var pdf = zcatpdf.Pdf.init(allocator, .{}); defer pdf.deinit(); // Create document with options -var pdf = zpdf.Pdf.init(allocator, .{ +var pdf = zcatpdf.Pdf.init(allocator, .{ .page_size = .a4, .orientation = .portrait, .unit = .pt, @@ -228,7 +228,7 @@ try page.setFont(.times_roman, 11); try page.setFont(.courier, 10); // Calculate string width -const width = zpdf.Font.helvetica.stringWidth("Hello", 12.0); +const width = zcatpdf.Font.helvetica.stringWidth("Hello", 12.0); ``` ### Available Fonts (Type1 built-in) @@ -255,7 +255,7 @@ const width = zpdf.Font.helvetica.stringWidth("Hello", 12.0); ```zig // Load TTF file const font_data = try std.fs.cwd().readFileAlloc(allocator, "font.ttf", 10_000_000); -var ttf = try zpdf.TrueTypeFont.parse(allocator, font_data); +var ttf = try zcatpdf.TrueTypeFont.parse(allocator, font_data); defer ttf.deinit(); // Get font info @@ -281,20 +281,20 @@ const width = ttf.stringWidth("Hello", 12.0); ```zig // Set colors -page.setFillColor(zpdf.Color.red); -page.setStrokeColor(zpdf.Color.blue); +page.setFillColor(zcatpdf.Color.red); +page.setStrokeColor(zcatpdf.Color.blue); // RGB (0-255) -page.setFillColor(zpdf.Color.rgb(255, 128, 0)); +page.setFillColor(zcatpdf.Color.rgb(255, 128, 0)); // Hex -page.setFillColor(zpdf.Color.hex(0xFF8000)); +page.setFillColor(zcatpdf.Color.hex(0xFF8000)); // Grayscale (0.0-1.0) -page.setFillColor(zpdf.Color.gray(0.5)); +page.setFillColor(zcatpdf.Color.gray(0.5)); // CMYK (0.0-1.0) -page.setFillColor(zpdf.Color.cmyk(0, 1, 1, 0)); // Red +page.setFillColor(zcatpdf.Color.cmyk(0, 1, 1, 0)); // Red ``` ### Predefined Colors @@ -442,12 +442,12 @@ try page.imageFit(img_idx, info, x, y, max_width, max_height); ```zig const col_widths = [_]f32{ 200, 100, 100, 100 }; -var table = zpdf.Table.init(page, .{ +var table = zcatpdf.Table.init(page, .{ .x = 50, .y = 700, .col_widths = &col_widths, .row_height = 20, - .header_bg_color = zpdf.Color.hex(0xE0E0E0), + .header_bg_color = zcatpdf.Color.hex(0xE0E0E0), .border = true, }); @@ -559,10 +559,10 @@ try page.drawCode128WithText(x, y, "ABC-12345", height, module_width, show_text) try page.drawQRCode(x, y, "https://example.com", size, error_correction); // Error correction levels -zpdf.QRCode.ErrorCorrection.L // 7% recovery -zpdf.QRCode.ErrorCorrection.M // 15% recovery -zpdf.QRCode.ErrorCorrection.Q // 25% recovery -zpdf.QRCode.ErrorCorrection.H // 30% recovery +zcatpdf.QRCode.ErrorCorrection.L // 7% recovery +zcatpdf.QRCode.ErrorCorrection.M // 15% recovery +zcatpdf.QRCode.ErrorCorrection.Q // 25% recovery +zcatpdf.QRCode.ErrorCorrection.H // 30% recovery ``` ### Types @@ -641,15 +641,15 @@ try page.setOpacity(1.0); ```zig // Horizontal gradient try page.linearGradientRect(x, y, width, height, - zpdf.Color.red, zpdf.Color.blue, .horizontal); + zcatpdf.Color.red, zcatpdf.Color.blue, .horizontal); // Vertical gradient try page.linearGradientRect(x, y, width, height, - zpdf.Color.green, zpdf.Color.yellow, .vertical); + zcatpdf.Color.green, zcatpdf.Color.yellow, .vertical); // Diagonal gradient try page.linearGradientRect(x, y, width, height, - zpdf.Color.purple, zpdf.Color.cyan, .diagonal); + zcatpdf.Color.purple, zcatpdf.Color.cyan, .diagonal); ``` ### Radial Gradients @@ -657,11 +657,11 @@ try page.linearGradientRect(x, y, width, height, ```zig // Circle gradient (center to edge) try page.radialGradientCircle(cx, cy, radius, - zpdf.Color.white, zpdf.Color.blue); + zcatpdf.Color.white, zcatpdf.Color.blue); // Ellipse gradient try page.radialGradientEllipse(cx, cy, rx, ry, - zpdf.Color.yellow, zpdf.Color.red); + zcatpdf.Color.yellow, zcatpdf.Color.red); ``` ### Types @@ -683,11 +683,11 @@ Templates define reusable document layouts with named regions. ```zig // Use predefined invoice template -var tmpl = try zpdf.Template.invoiceTemplate(allocator); +var tmpl = try zcatpdf.Template.invoiceTemplate(allocator); defer tmpl.deinit(); // Or create custom template -var tmpl = zpdf.Template.init(allocator, "custom", 595, 842); +var tmpl = zcatpdf.Template.init(allocator, "custom", 595, 842); defer tmpl.deinit(); try tmpl.defineRegion("header", .{ @@ -727,7 +727,7 @@ if (tmpl.getRegion("header")) |region| { Parse Markdown-style text and render with appropriate styles. ```zig -var renderer = zpdf.MarkdownRenderer.init(allocator); +var renderer = zcatpdf.MarkdownRenderer.init(allocator); defer renderer.deinit(); try renderer.parse( @@ -744,11 +744,11 @@ try renderer.parse( // Render to PDF for (renderer.getLines()) |line| { for (line.spans) |span| { - const font = zpdf.MarkdownRenderer.fontForStyle(span.style); + const font = zcatpdf.MarkdownRenderer.fontForStyle(span.style); try page.setFont(font, span.font_size orelse 12); if (span.color) |color| { - page.setFillColor(zpdf.Color.hex(color)); + page.setFillColor(zcatpdf.Color.hex(color)); } try page.drawText(x, y, span.text); @@ -789,7 +789,7 @@ for (renderer.getLines()) |line| { ```zig // Configure compression when creating document -var pdf = zpdf.Pdf.init(allocator, .{ +var pdf = zcatpdf.Pdf.init(allocator, .{ .compression = .{ .enabled = true, .level = 6, // 0-12, higher = better compression diff --git a/build.zig b/build.zig index 8f0e2c3..8d840b9 100644 --- a/build.zig +++ b/build.zig @@ -11,13 +11,13 @@ pub fn build(b: *std.Build) void { }); const libdeflate_lib = libdeflate_dep.artifact("deflate"); - // zpdf module with libdeflate - const zpdf_mod = b.createModule(.{ + // zcatpdf module with libdeflate + const zcatpdf_mod = b.createModule(.{ .root_source_file = b.path("src/root.zig"), .target = target, .optimize = optimize, }); - zpdf_mod.linkLibrary(libdeflate_lib); + zcatpdf_mod.linkLibrary(libdeflate_lib); // Tests const unit_tests = b.addTest(.{ @@ -61,7 +61,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, .imports = &.{ - .{ .name = "zpdf", .module = zpdf_mod }, + .{ .name = "zcatpdf", .module = zcatpdf_mod }, }, }), }); diff --git a/examples/barcode_demo.zig b/examples/barcode_demo.zig index f79d79f..e1f7dc6 100644 --- a/examples/barcode_demo.zig +++ b/examples/barcode_demo.zig @@ -3,10 +3,10 @@ //! Demonstrates barcode generation for product labels, shipping, URLs, etc. const std = @import("std"); -const zpdf = @import("zpdf"); -const Pdf = zpdf.Pdf; -const Color = zpdf.Color; -const QRCode = zpdf.QRCode; +const zcatpdf = @import("zcatpdf"); +const Pdf = zcatpdf.Pdf; +const Color = zcatpdf.Color; +const QRCode = zcatpdf.QRCode; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -17,7 +17,7 @@ pub fn main() !void { defer pdf.deinit(); pdf.setTitle("Barcode Demo"); - pdf.setAuthor("zpdf"); + pdf.setAuthor("zcatpdf"); var page = try pdf.addPage(.{}); @@ -28,7 +28,7 @@ pub fn main() !void { try page.setFont(.helvetica, 12); page.setFillColor(Color.hex(0x666666)); - try page.drawText(50, 760, "Code128 barcode generation with zpdf"); + try page.drawText(50, 760, "Code128 barcode generation with zcatpdf"); // Reset to black for barcodes page.setFillColor(Color.black); @@ -111,7 +111,7 @@ pub fn main() !void { // Footer try page.setFont(.helvetica_oblique, 10); page.setFillColor(Color.hex(0x999999)); - try page.drawText(50, 50, "Generated with zpdf - Code128 and QR Code Support"); + try page.drawText(50, 50, "Generated with zcatpdf - Code128 and QR Code Support"); try pdf.save("barcode_demo.pdf"); diff --git a/examples/bookmarks_demo.zig b/examples/bookmarks_demo.zig index ff04e84..4ebbbd0 100644 --- a/examples/bookmarks_demo.zig +++ b/examples/bookmarks_demo.zig @@ -4,20 +4,20 @@ //! The bookmarks appear in the sidebar of PDF readers for navigation. const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Bookmarks Demo\n", .{}); + std.debug.print("zcatpdf - Bookmarks Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Bookmarks Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); // ========================================================================= // Page 1: Introduction @@ -37,7 +37,7 @@ pub fn main() !void { try page.setFont(.helvetica, 12); page.setFillColor(pdf.Color.black); const intro_text = - \\This document demonstrates the bookmark/outline feature of zpdf. + \\This document demonstrates the bookmark/outline feature of zcatpdf. \\ \\Bookmarks (also called "outlines") appear in the sidebar of PDF readers \\and allow quick navigation to different sections of the document. @@ -50,7 +50,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Page 1 of 4 - zpdf Bookmarks Demo", pdf.Border.none, .center, false); + try page.cell(0, 15, "Page 1 of 4 - zcatpdf Bookmarks Demo", pdf.Border.none, .center, false); } // ========================================================================= @@ -73,7 +73,7 @@ pub fn main() !void { const chapter1_text = \\This is Chapter 1 of our document. \\ - \\In this chapter, we cover the basics of using zpdf to create + \\In this chapter, we cover the basics of using zcatpdf to create \\PDF documents with bookmarks for easy navigation. \\ \\Key topics: @@ -88,7 +88,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Page 2 of 4 - zpdf Bookmarks Demo", pdf.Border.none, .center, false); + try page.cell(0, 15, "Page 2 of 4 - zcatpdf Bookmarks Demo", pdf.Border.none, .center, false); } // ========================================================================= @@ -125,7 +125,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Page 3 of 4 - zpdf Bookmarks Demo", pdf.Border.none, .center, false); + try page.cell(0, 15, "Page 3 of 4 - zcatpdf Bookmarks Demo", pdf.Border.none, .center, false); } // ========================================================================= @@ -154,7 +154,7 @@ pub fn main() !void { \\ 3. Each bookmark links to a specific page and position \\ \\Use doc.addBookmark() or doc.addBookmarkAt() to add bookmarks - \\to your zpdf documents. + \\to your zcatpdf documents. ; try page.multiCell(500, null, conclusion_text, pdf.Border.none, .left, false); @@ -162,7 +162,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Page 4 of 4 - zpdf Bookmarks Demo", pdf.Border.none, .center, false); + try page.cell(0, 15, "Page 4 of 4 - zcatpdf Bookmarks Demo", pdf.Border.none, .center, false); } // Save diff --git a/examples/curves_demo.zig b/examples/curves_demo.zig index c0e7bb5..ec7cca7 100644 --- a/examples/curves_demo.zig +++ b/examples/curves_demo.zig @@ -1,25 +1,25 @@ //! Curves Demo - Bezier Curves, Circles, Ellipses, and Arcs //! -//! Demonstrates the curve drawing capabilities of zpdf including: +//! Demonstrates the curve drawing capabilities of zcatpdf including: //! - Cubic and quadratic Bezier curves //! - Circles and ellipses //! - Arcs const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Curves Demo\n", .{}); + std.debug.print("zcatpdf - Curves Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Curves Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); // ========================================================================= // Page 1: Bezier Curves @@ -110,7 +110,7 @@ pub fn main() !void { // Footer try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(250, 50, "Page 1 of 2 - zpdf Curves Demo"); + try page.drawText(250, 50, "Page 1 of 2 - zcatpdf Curves Demo"); } // ========================================================================= @@ -235,7 +235,7 @@ pub fn main() !void { // Footer try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(250, 50, "Page 2 of 2 - zpdf Curves Demo"); + try page.drawText(250, 50, "Page 2 of 2 - zcatpdf Curves Demo"); } // Save diff --git a/examples/gradient_demo.zig b/examples/gradient_demo.zig index 98d0722..8ab8471 100644 --- a/examples/gradient_demo.zig +++ b/examples/gradient_demo.zig @@ -3,10 +3,10 @@ //! Demonstrates gradient fills for rectangles, circles and ellipses. const std = @import("std"); -const zpdf = @import("zpdf"); -const Pdf = zpdf.Pdf; -const Color = zpdf.Color; -const GradientDirection = zpdf.GradientDirection; +const zcatpdf = @import("zcatpdf"); +const Pdf = zcatpdf.Pdf; +const Color = zcatpdf.Color; +const GradientDirection = zcatpdf.GradientDirection; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -17,7 +17,7 @@ pub fn main() !void { defer pdf.deinit(); pdf.setTitle("Gradient Demo"); - pdf.setAuthor("zpdf"); + pdf.setAuthor("zcatpdf"); var page = try pdf.addPage(.{}); @@ -28,7 +28,7 @@ pub fn main() !void { try page.setFont(.helvetica, 12); page.setFillColor(Color.hex(0x666666)); - try page.drawText(50, 760, "Linear and radial gradients in zpdf"); + try page.drawText(50, 760, "Linear and radial gradients in zcatpdf"); // Section 1: Linear Gradients try page.setFont(.helvetica_bold, 16); @@ -112,7 +112,7 @@ pub fn main() !void { // Footer try page.setFont(.helvetica_oblique, 10); page.setFillColor(Color.hex(0x999999)); - try page.drawText(50, 50, "Generated with zpdf - Linear and Radial Gradient Support"); + try page.drawText(50, 50, "Generated with zcatpdf - Linear and Radial Gradient Support"); try pdf.save("gradient_demo.pdf"); diff --git a/examples/hello.zig b/examples/hello.zig index ca68ad7..13b30aa 100644 --- a/examples/hello.zig +++ b/examples/hello.zig @@ -1,14 +1,14 @@ //! Minimal PDF example - Hello World const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Hello World example\n", .{}); + std.debug.print("zcatpdf - Hello World example\n", .{}); // Create document var doc = pdf.Document.init(allocator); @@ -25,7 +25,7 @@ pub fn main() !void { // Subtitle try page.setFont(.helvetica, 14); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(50, 710, "Generated with zpdf - Pure Zig PDF library"); + try page.drawText(50, 710, "Generated with zcatpdf - Pure Zig PDF library"); // Draw a line try page.setLineWidth(1); @@ -36,7 +36,7 @@ pub fn main() !void { try page.setFont(.times_roman, 12); page.setFillColor(pdf.Color.black); try page.drawText(50, 670, "This PDF was generated entirely in Zig with zero external dependencies."); - try page.drawText(50, 655, "The zpdf library supports:"); + try page.drawText(50, 655, "The zcatpdf library supports:"); try page.drawText(70, 635, "- Multiple fonts (Helvetica, Times, Courier)"); try page.drawText(70, 620, "- Colors (RGB)"); try page.drawText(70, 605, "- Lines and rectangles"); @@ -63,7 +63,7 @@ pub fn main() !void { // Footer try page.setFont(.courier, 10); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(50, 50, "zpdf v0.1.0 - https://git.reugenio.com/reugenio/zpdf"); + try page.drawText(50, 50, "zcatpdf v0.1.0 - https://git.reugenio.com/reugenio/zcatpdf"); // Save const filename = "hello.pdf"; diff --git a/examples/image_demo.zig b/examples/image_demo.zig index 5deea79..d2afa4d 100644 --- a/examples/image_demo.zig +++ b/examples/image_demo.zig @@ -5,14 +5,14 @@ //! If no path is provided, creates a simple PDF with text explaining the features. const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Image Demo\n", .{}); + std.debug.print("zcatpdf - Image Demo\n", .{}); // Get command line args const args = try std.process.argsAlloc(allocator); @@ -22,7 +22,7 @@ pub fn main() !void { defer doc.deinit(); doc.setTitle("Image Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); var page = try doc.addPage(.{}); page.setMargins(50, 50, 50); @@ -223,7 +223,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Generated with zpdf - Pure Zig PDF Library", pdf.Border.none, .center, false); + try page.cell(0, 15, "Generated with zcatpdf - Pure Zig PDF Library", pdf.Border.none, .center, false); // Save const filename = "image_demo.pdf"; diff --git a/examples/invoice.zig b/examples/invoice.zig index b7d23c1..e804c1e 100644 --- a/examples/invoice.zig +++ b/examples/invoice.zig @@ -1,14 +1,14 @@ //! Invoice PDF example - Demonstrates a realistic use case const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Invoice example\n", .{}); + std.debug.print("zcatpdf - Invoice example\n", .{}); var doc = pdf.Document.init(allocator); defer doc.deinit(); diff --git a/examples/links_demo.zig b/examples/links_demo.zig index 179484e..1d70d71 100644 --- a/examples/links_demo.zig +++ b/examples/links_demo.zig @@ -6,20 +6,20 @@ //! - Visual link styling (blue underlined text) const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Links Demo\n", .{}); + std.debug.print("zcatpdf - Links Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Links Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); // ========================================================================= // Page 1: External URL Links @@ -150,7 +150,7 @@ pub fn main() !void { \\- /Border: Border style (we use [0 0 0] for invisible borders) \\ \\The visual styling (blue text + underline) is separate from the annotation. - \\zpdf's urlLink() and writeUrlLink() methods combine both automatically. + \\zcatpdf's urlLink() and writeUrlLink() methods combine both automatically. ; try page2.multiCell(500, null, tech_text, pdf.Border.none, .left, false); @@ -161,7 +161,7 @@ pub fn main() !void { }); // Footer - try pdf.Pagination.addFooter(&doc, "Generated with zpdf - Links Demo", .{ + try pdf.Pagination.addFooter(&doc, "Generated with zcatpdf - Links Demo", .{ .alignment = .center, .font_size = 8, .color = pdf.Color.light_gray, diff --git a/examples/markdown_demo.zig b/examples/markdown_demo.zig index 0935796..ae7f7d4 100644 --- a/examples/markdown_demo.zig +++ b/examples/markdown_demo.zig @@ -3,27 +3,27 @@ //! Run with: zig build markdown_demo && ./zig-out/bin/markdown_demo const std = @import("std"); -const zpdf = @import("zpdf"); +const zcatpdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("=== zpdf Markdown Demo ===\n\n", .{}); + std.debug.print("=== zcatpdf Markdown Demo ===\n\n", .{}); // Create PDF - var pdf = zpdf.Pdf.init(allocator, .{}); + var pdf = zcatpdf.Pdf.init(allocator, .{}); defer pdf.deinit(); pdf.setTitle("Markdown Styled Document"); - pdf.setAuthor("zpdf Markdown Renderer"); + pdf.setAuthor("zcatpdf Markdown Renderer"); var page = try pdf.addPage(.{}); // Sample markdown text const markdown_text = - \\# Welcome to zpdf Markdown + \\# Welcome to zcatpdf Markdown \\ \\This is a demonstration of **Markdown-styled** text rendering in PDF. \\ @@ -40,7 +40,7 @@ pub fn main() !void { \\### Code and Technical Content \\ \\You can write technical documentation with styled text. - \\For example, the *zpdf* library is written in **Zig** and provides + \\For example, the *zcatpdf* library is written in **Zig** and provides \\a simple API for PDF generation. \\ \\## Numbered Lists @@ -56,7 +56,7 @@ pub fn main() !void { ; // Parse markdown - var renderer = zpdf.MarkdownRenderer.init(allocator); + var renderer = zcatpdf.MarkdownRenderer.init(allocator); defer renderer.deinit(); try renderer.parse(markdown_text); @@ -94,7 +94,7 @@ pub fn main() !void { switch (line.line_type) { .bullet => { try page.setFont(.helvetica, base_font_size); - page.setFillColor(zpdf.Color.black); + page.setFillColor(zcatpdf.Color.black); try page.drawText(x, y, "\xe2\x80\xa2"); // Bullet point (UTF-8) // Note: PDF Type1 fonts don't support UTF-8, so we use a simple dash try page.drawText(x, y, "-"); @@ -104,7 +104,7 @@ pub fn main() !void { .numbered => { list_number += 1; try page.setFont(.helvetica, base_font_size); - page.setFillColor(zpdf.Color.black); + page.setFillColor(zcatpdf.Color.black); var num_buf: [16]u8 = undefined; const num_str = std.fmt.bufPrint(&num_buf, "{d}.", .{list_number}) catch "?."; try page.drawText(x, y, num_str); @@ -118,16 +118,16 @@ pub fn main() !void { // Render spans for (line.spans) |span| { // Set font based on style - const font = zpdf.MarkdownRenderer.fontForStyle(span.style); + const font = zcatpdf.MarkdownRenderer.fontForStyle(span.style); const font_size = span.font_size orelse base_font_size; try page.setFont(font, font_size); // Set color if (span.color) |color| { - page.setFillColor(zpdf.Color.hex(color)); + page.setFillColor(zcatpdf.Color.hex(color)); } else { - page.setFillColor(zpdf.Color.black); + page.setFillColor(zcatpdf.Color.black); } // Draw text @@ -136,7 +136,7 @@ pub fn main() !void { // Draw underline if needed if (span.style.underline) { const text_width = font.stringWidth(span.text, font_size); - page.setStrokeColor(if (span.color) |c| zpdf.Color.hex(c) else zpdf.Color.black); + page.setStrokeColor(if (span.color) |c| zcatpdf.Color.hex(c) else zcatpdf.Color.black); try page.setLineWidth(0.5); try page.drawLine(x, y - 2, x + text_width, y - 2); } @@ -144,7 +144,7 @@ pub fn main() !void { // Draw strikethrough if needed if (span.style.strikethrough) { const text_width = font.stringWidth(span.text, font_size); - page.setStrokeColor(zpdf.Color.black); + page.setStrokeColor(zcatpdf.Color.black); try page.setLineWidth(0.5); const strike_y = y + font_size * 0.3; try page.drawLine(x, strike_y, x + text_width, strike_y); diff --git a/examples/pagination_demo.zig b/examples/pagination_demo.zig index 80b5d0b..a2d2cce 100644 --- a/examples/pagination_demo.zig +++ b/examples/pagination_demo.zig @@ -3,20 +3,20 @@ //! Shows how to add page numbers and footers to multi-page documents. const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Pagination Demo\n", .{}); + std.debug.print("zcatpdf - Pagination Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Pagination Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); // Create multiple pages with content const num_pages: usize = 5; @@ -79,7 +79,7 @@ pub fn main() !void { } // Add header to all pages (with line separator) - try pdf.addHeader(&doc, "zpdf Library - Multi-Page Document Example", .{ + try pdf.addHeader(&doc, "zcatpdf Library - Multi-Page Document Example", .{ .alignment = .center, .margin = 30, .font_size = 9, diff --git a/examples/table_demo.zig b/examples/table_demo.zig index 996615c..02699b7 100644 --- a/examples/table_demo.zig +++ b/examples/table_demo.zig @@ -4,20 +4,20 @@ //! alternating colors, and custom styling. const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Table Demo\n", .{}); + std.debug.print("zcatpdf - Table Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Table Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); var page = try doc.addPage(.{}); page.setMargins(50, 50, 50); @@ -146,7 +146,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Generated with zpdf - Table Helper Demo", pdf.Border.none, .center, false); + try page.cell(0, 15, "Generated with zcatpdf - Table Helper Demo", pdf.Border.none, .center, false); // Save const filename = "table_demo.pdf"; diff --git a/examples/template_demo.zig b/examples/template_demo.zig index 994e136..3168fcc 100644 --- a/examples/template_demo.zig +++ b/examples/template_demo.zig @@ -3,14 +3,14 @@ //! Run with: zig build template_demo && ./zig-out/bin/template_demo const std = @import("std"); -const zpdf = @import("zpdf"); +const zcatpdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("=== zpdf Template Demo ===\n\n", .{}); + std.debug.print("=== zcatpdf Template Demo ===\n\n", .{}); // Create invoice using template try createInvoiceFromTemplate(allocator); @@ -25,14 +25,14 @@ fn createInvoiceFromTemplate(allocator: std.mem.Allocator) !void { std.debug.print("Creating invoice from template...\n", .{}); // Get the invoice template - var tmpl = try zpdf.Template.invoiceTemplate(allocator); + var tmpl = try zcatpdf.Template.invoiceTemplate(allocator); defer tmpl.deinit(); std.debug.print(" Template: {s}\n", .{tmpl.name}); std.debug.print(" Page size: {d:.0} x {d:.0} points\n", .{ tmpl.page_width, tmpl.page_height }); // Create PDF based on template - var pdf = zpdf.Pdf.init(allocator, .{}); + var pdf = zcatpdf.Pdf.init(allocator, .{}); defer pdf.deinit(); pdf.setTitle("Invoice from Template"); @@ -72,10 +72,10 @@ fn createInvoiceFromTemplate(allocator: std.mem.Allocator) !void { std.debug.print(" Items region: ({d:.0}, {d:.0}) {d:.0}x{d:.0}\n", .{ region.x, region.y, region.width, region.height }); // Draw table header - page.setFillColor(zpdf.Color.hex(0xE0E0E0)); + page.setFillColor(zcatpdf.Color.hex(0xE0E0E0)); try page.fillRect(region.x, region.y + region.height - 25, region.width, 25); - page.setFillColor(zpdf.Color.black); + page.setFillColor(zcatpdf.Color.black); try page.setFont(.helvetica_bold, 10); try page.drawText(region.x + 5, region.y + region.height - 17, "Description"); try page.drawText(region.x + 250, region.y + region.height - 17, "Qty"); @@ -100,7 +100,7 @@ fn createInvoiceFromTemplate(allocator: std.mem.Allocator) !void { } // Draw table border - page.setStrokeColor(zpdf.Color.black); + page.setStrokeColor(zcatpdf.Color.black); try page.drawRect(region.x, region.y, region.width, region.height); } @@ -123,7 +123,7 @@ fn createInvoiceFromTemplate(allocator: std.mem.Allocator) !void { if (tmpl.getRegion("footer")) |region| { std.debug.print(" Footer region: ({d:.0}, {d:.0})\n", .{ region.x, region.y }); try page.setFont(.helvetica, 8); - page.setFillColor(zpdf.Color.hex(0x666666)); + page.setFillColor(zcatpdf.Color.hex(0x666666)); try page.drawText(region.x, region.y + 20, "Payment Terms: Net 14 days"); try page.drawText(region.x, region.y + 8, "Thank you for your business!"); } @@ -136,13 +136,13 @@ fn createLetterFromTemplate(allocator: std.mem.Allocator) !void { std.debug.print("\nCreating letter from template...\n", .{}); // Get the letter template - var tmpl = try zpdf.Template.letterTemplate(allocator); + var tmpl = try zcatpdf.Template.letterTemplate(allocator); defer tmpl.deinit(); std.debug.print(" Template: {s}\n", .{tmpl.name}); // Create PDF based on template - var pdf = zpdf.Pdf.init(allocator, .{}); + var pdf = zcatpdf.Pdf.init(allocator, .{}); defer pdf.deinit(); pdf.setTitle("Letter from Template"); diff --git a/examples/text_demo.zig b/examples/text_demo.zig index 29b8da9..c008240 100644 --- a/examples/text_demo.zig +++ b/examples/text_demo.zig @@ -1,20 +1,20 @@ //! Text System Demo - Demonstrates cell(), multiCell(), alignment, etc. const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Text System Demo\n", .{}); + std.debug.print("zcatpdf - Text System Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Text System Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); var page = try doc.addPage(.{}); @@ -74,7 +74,7 @@ pub fn main() !void { page.setFillColor(pdf.Color.rgb(245, 245, 245)); const long_text = - \\This is a demonstration of the multiCell function in zpdf. + \\This is a demonstration of the multiCell function in zcatpdf. \\It automatically wraps text to fit within the specified width. \\ \\You can include explicit line breaks using backslash-n, and the @@ -171,7 +171,7 @@ pub fn main() !void { page.setXY(50, 50); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.cell(0, 15, "Generated with zpdf - Pure Zig PDF Library", pdf.Border.none, .center, false); + try page.cell(0, 15, "Generated with zcatpdf - Pure Zig PDF Library", pdf.Border.none, .center, false); // Save const filename = "text_demo.pdf"; diff --git a/examples/transforms_demo.zig b/examples/transforms_demo.zig index e39258d..9c3c459 100644 --- a/examples/transforms_demo.zig +++ b/examples/transforms_demo.zig @@ -1,6 +1,6 @@ //! Transforms Demo - Rotation, Scaling, Skew, and Translation //! -//! Demonstrates the transformation capabilities of zpdf including: +//! Demonstrates the transformation capabilities of zcatpdf including: //! - Rotation around a point //! - Scaling from a point //! - Skewing (shearing) @@ -8,20 +8,20 @@ //! - Combined transformations const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Transforms Demo\n", .{}); + std.debug.print("zcatpdf - Transforms Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Transforms Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); // ========================================================================= // Page 1: Rotation @@ -157,7 +157,7 @@ pub fn main() !void { // Footer try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(250, 50, "Page 1 of 2 - zpdf Transforms Demo"); + try page.drawText(250, 50, "Page 1 of 2 - zcatpdf Transforms Demo"); } // ========================================================================= @@ -323,7 +323,7 @@ pub fn main() !void { // Footer try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(250, 50, "Page 2 of 2 - zpdf Transforms Demo"); + try page.drawText(250, 50, "Page 2 of 2 - zcatpdf Transforms Demo"); } // Save diff --git a/examples/transparency_demo.zig b/examples/transparency_demo.zig index 9bee31c..6c3093c 100644 --- a/examples/transparency_demo.zig +++ b/examples/transparency_demo.zig @@ -1,25 +1,25 @@ //! Transparency Demo - Alpha/Opacity Support //! -//! Demonstrates the transparency capabilities of zpdf including: +//! Demonstrates the transparency capabilities of zcatpdf including: //! - Fill opacity for shapes and text //! - Stroke opacity for lines and outlines //! - Layered transparent objects const std = @import("std"); -const pdf = @import("zpdf"); +const pdf = @import("zcatpdf"); pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; defer _ = gpa.deinit(); const allocator = gpa.allocator(); - std.debug.print("zpdf - Transparency Demo\n", .{}); + std.debug.print("zcatpdf - Transparency Demo\n", .{}); var doc = pdf.Pdf.init(allocator, .{}); defer doc.deinit(); doc.setTitle("Transparency Demo"); - doc.setAuthor("zpdf"); + doc.setAuthor("zcatpdf"); const page = try doc.addPage(.{}); @@ -198,7 +198,7 @@ pub fn main() !void { try page.setOpacity(1.0); try page.setFont(.helvetica, 9); page.setFillColor(pdf.Color.medium_gray); - try page.drawText(250, 50, "zpdf Transparency Demo"); + try page.drawText(250, 50, "zcatpdf Transparency Demo"); // Save const filename = "transparency_demo.pdf"; diff --git a/examples/ttf_demo.zig b/examples/ttf_demo.zig index ee7e375..4a25ff3 100644 --- a/examples/ttf_demo.zig +++ b/examples/ttf_demo.zig @@ -3,10 +3,10 @@ //! Demonstrates loading and using TrueType fonts. const std = @import("std"); -const zpdf = @import("zpdf"); -const Pdf = zpdf.Pdf; -const Color = zpdf.Color; -const TrueTypeFont = zpdf.TrueTypeFont; +const zcatpdf = @import("zcatpdf"); +const Pdf = zcatpdf.Pdf; +const Color = zcatpdf.Color; +const TrueTypeFont = zcatpdf.TrueTypeFont; pub fn main() !void { var gpa = std.heap.GeneralPurposeAllocator(.{}){}; @@ -17,7 +17,7 @@ pub fn main() !void { defer pdf.deinit(); pdf.setTitle("TrueType Font Demo"); - pdf.setAuthor("zpdf"); + pdf.setAuthor("zcatpdf"); // Try to load a system TTF font const font_paths = [_][]const u8{ diff --git a/src/compression/mod.zig b/src/compression/mod.zig index a7ad50b..df0cddb 100644 --- a/src/compression/mod.zig +++ b/src/compression/mod.zig @@ -1,4 +1,4 @@ -//! Compression module for zpdf +//! Compression module for zcatpdf //! //! Provides zlib/deflate compression and decompression using libdeflate. //! Used for PNG image processing and PDF stream compression. diff --git a/src/compression/zlib.zig b/src/compression/zlib.zig index 5684cd6..74b2d2f 100644 --- a/src/compression/zlib.zig +++ b/src/compression/zlib.zig @@ -1,4 +1,4 @@ -//! zlib compression utilities for zpdf +//! zlib compression utilities for zcatpdf //! //! Provides compression and decompression using libdeflate. //! Used for PNG image processing and PDF stream compression. diff --git a/src/images/mod.zig b/src/images/mod.zig index dcfd229..14629e2 100644 --- a/src/images/mod.zig +++ b/src/images/mod.zig @@ -1,4 +1,4 @@ -//! Image module for zpdf +//! Image module for zcatpdf //! //! Provides image parsing and embedding support for PDF generation. //! Supports JPEG (direct embedding) and PNG (with alpha support). diff --git a/src/output/producer.zig b/src/output/producer.zig index 0d56efe..637d0cb 100644 --- a/src/output/producer.zig +++ b/src/output/producer.zig @@ -254,7 +254,7 @@ pub const OutputProducer = struct { try base.writeString(writer, creator); try writer.writeByte('\n'); } - try writer.writeAll("/Producer (zpdf)\n"); + try writer.writeAll("/Producer (zcatpdf)\n"); try writer.writeAll(">>\n"); try self.endObject(); diff --git a/src/pdf.zig b/src/pdf.zig index 9c2a2ed..6375496 100644 --- a/src/pdf.zig +++ b/src/pdf.zig @@ -29,7 +29,7 @@ const png = @import("images/png.zig"); const images_mod = @import("images/mod.zig"); const Outline = @import("outline.zig").Outline; -/// Configuration constants for zpdf +/// Configuration constants for zcatpdf pub const Config = struct { /// Maximum file size for image loading (default: 10MB) pub const max_image_file_size: usize = 10 * 1024 * 1024; diff --git a/src/root.zig b/src/root.zig index 386ea8f..1dbada1 100644 --- a/src/root.zig +++ b/src/root.zig @@ -1,15 +1,15 @@ -//! zpdf - PDF generation library for Zig +//! zcatpdf - PDF generation library for Zig //! -//! A pure Zig library for creating PDF documents with zero dependencies. +//! A pure Zig library for creating PDF documents with minimal dependencies. //! Based on fpdf2 (Python) architecture. //! //! ## Quick Start //! //! ```zig -//! const zpdf = @import("zpdf"); +//! const zcatpdf = @import("zcatpdf"); //! //! pub fn main() !void { -//! var pdf = zpdf.Pdf.init(allocator, .{}); +//! var pdf = zcatpdf.Pdf.init(allocator, .{}); //! defer pdf.deinit(); //! //! var page = try pdf.addPage(.{}); @@ -190,7 +190,7 @@ pub const Document = struct { // Tests // ============================================================================= -test "zpdf re-exports" { +test "zcatpdf re-exports" { // Test that all types are accessible _ = Pdf; _ = Page; @@ -221,19 +221,19 @@ test "Document backwards compatibility" { test "new Pdf API" { const allocator = std.testing.allocator; - var zpdf_doc = Pdf.init(allocator, .{ + var pdf_doc = Pdf.init(allocator, .{ .page_size = .a4, .orientation = .portrait, }); - defer zpdf_doc.deinit(); + defer pdf_doc.deinit(); - zpdf_doc.setTitle("Test Document"); - zpdf_doc.setAuthor("zpdf"); + pdf_doc.setTitle("Test Document"); + pdf_doc.setAuthor("zcatpdf"); - var pg = try zpdf_doc.addPage(.{}); + var pg = try pdf_doc.addPage(.{}); try pg.setFont(.helvetica_bold, 24); pg.setFillColor(Color.blue); - try pg.drawText(50, 750, "Hello zpdf!"); + try pg.drawText(50, 750, "Hello zcatpdf!"); pg.setStrokeColor(Color.red); try pg.setLineWidth(2); @@ -242,7 +242,7 @@ test "new Pdf API" { pg.setFillColor(Color.light_gray); try pg.fillRect(50, 600, 150, 100); - const data = try zpdf_doc.output(); + const data = try pdf_doc.output(); defer allocator.free(data); try std.testing.expect(std.mem.startsWith(u8, data, "%PDF-1.4"));