utilvopdfmerger

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: MIT Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

utilvo-pdf-merger

Lightweight, zero-dependency library for inspecting PDF binary headers, counting /Type /Page objects, validating cross-reference (xref) tables, and merging multiple PDF byte streams into a single document with renumbered indirect objects.

Installation

Node.js (npm)
npm install utilvo-pdf-merger
Python (PyPI)
pip install utilvo-pdf-merger
Rust (Cargo)
cargo add utilvo-pdf-merger
Go
go get github.com/utilvo/utilvo-pdf-merger

Quick Start

JavaScript / TypeScript
import { inspectPdf, countPdfPages, mergePdfBuffers } from 'utilvo-pdf-merger';

const info = inspectPdf(pdfBytes);
console.log(info.version, info.pageCount, info.isValid);

const mergedBytes = mergePdfBuffers([pdfBufferA, pdfBufferB]);
Python
from utilvo_pdf_merger import inspect_pdf, count_pdf_pages, merge_pdf_bytes

info = inspect_pdf(pdf_bytes)
print(info["version"], info["page_count"], info["is_valid"])

merged = merge_pdf_bytes([pdf_a, pdf_b])

API Reference

Function Parameters Returns Description
inspectPdf / inspect_pdf bytes: Uint8Array | bytes PdfInspectionResult Extracts PDF specification version (1.4–2.0), page count, startxref offset, and %%EOF integrity status.
countPdfPages / count_pdf_pages bytes: Uint8Array | bytes number Counts leaf /Type /Page dictionary entries (excluding /Type /Pages parent nodes).
mergePdfBuffers / merge_pdf_bytes documents: Array<Uint8Array | bytes> Uint8Array | bytes Extracts page content streams and constructs a consolidated PDF document with a unified /Pages root and rebuilt xref table.

License

MIT

Documentation

Overview

Package utilvopdfmerger provides lightweight utilities for inspecting PDF headers, counting page objects, and merging PDF byte streams with a rebuilt xref table.

Official documentation: https://utilvo.com/pdf-tools/merge-pdf

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CountPdfPages

func CountPdfPages(data []byte) int

CountPdfPages counts leaf /Type /Page dictionary entries in a PDF buffer.

func MergePdfBuffers

func MergePdfBuffers(documents [][]byte) ([]byte, error)

MergePdfBuffers merges multiple PDF byte slices into a consolidated PDF document.

Types

type PdfInfo

type PdfInfo struct {
	IsValid    bool
	Version    string
	PageCount  int
	HasEOF     bool
	ByteLength int
}

PdfInfo holds structural metadata extracted from a PDF byte buffer.

func InspectPdf

func InspectPdf(data []byte) PdfInfo

InspectPdf inspects a PDF byte buffer and returns its version, page count, and EOF status.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL