Skip to content

oxisto/pdf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pdf

build Go Reference

This library is a fork of https://github.com/rsc/pdf, which aims to fix some of the outstanding issues.

go get github.com/oxisto/pdf

Basic Usage

In order to display a very basic plain text representation of the PDF file, the following snippet can be used:

import (
    "fmt"
    "os"

    "github.com/oxisto/pdf"
)

func main() {
    r, err := pdf.Open("test.pdf")
    defer r.Close()
    if err != nil {
        panic(err)
    }
    for i := 1; i <= r.NumPage(); i++ {
        page := r.Page(i)
        fmt.Print(page.Content().Plain())
        fmt.Println()
    }
}

The pdfcat utility that is also included basically demonstrates the same functionality.

go install github.com/oxisto/pdf/cmd/pdfcat@latest
pdfcat test.pdf