Documentation ¶
Overview ¶
Package pdf provides support for reading and writing PDF files.
This package treats PDF files as containers containing a sequence of objects (typically Dictionaries and Streams). Object are written sequentially, but can be read in any order. These objects represent pages of text, fonts, images and so on. Subpackages implement support to produce PDF files representing pages of text and images.
A Reader can be used to read objects from an existing PDF file:
r, err := pdf.Open("in.pdf") if err != nil { log.Fatal(err) } defer r.Close() ... use r.Catalog to locate objects in the file ...
A Writer can be used to write objects to a new PDF file:
w, err := pdf.Create("out.pdf") if err != nil { log.Fatal(err) } ... add objects to the document using w.Write() and w.OpenStream() ... w.Catalog.Pages = ... // set the page tree err = out.Close() if err != nil { log.Fatal(err) }
The following classes represent the native PDF object types: Array, Boolean, Dict, Integer, Name, Real, Reference, *Stream, String. All of these implement the Object interface.
Index ¶
- Constants
- Variables
- func CheckVersion(pdf Putter, operation string, minVersion Version) error
- func DecodeDict(r Getter, dst interface{}, src Dict) error
- func DecodeStream(r Getter, x *Stream, numFilters int) (io.Reader, error)
- func Format(obj Object) string
- func IsMalformed(err error) bool
- func IsTagged(pdf Putter) bool
- func Wrap(err error, loc string) error
- type Array
- type AuthenticationError
- type Boolean
- type Catalog
- type Data
- func (d *Data) Alloc() Reference
- func (d *Data) AutoClose(obj io.Closer)
- func (d *Data) Close() error
- func (d *Data) Get(ref Reference, _ bool) (Object, error)
- func (d *Data) GetMeta() *MetaInfo
- func (d *Data) OpenStream(ref Reference, dict Dict, filters ...Filter) (io.WriteCloser, error)
- func (d *Data) Put(ref Reference, obj Object) error
- func (d *Data) Write(w io.Writer) error
- func (d *Data) WriteCompressed(refs []Reference, objects ...Object) error
- type Dict
- type FileInfo
- type FileObject
- type FileSection
- type Filter
- type FilterASCII85
- type FilterCompress
- type FilterFlate
- type FilterLZW
- type Getter
- type Info
- type Integer
- type MalformedFileError
- type MetaInfo
- type Name
- type Number
- type Object
- type Perm
- type Placeholder
- type Putter
- type Reader
- type ReaderErrorHandling
- type ReaderOptions
- type Real
- type Rectangle
- func (r *Rectangle) Dx() float64
- func (r *Rectangle) Dy() float64
- func (r *Rectangle) Extend(other *Rectangle)
- func (r Rectangle) IsZero() bool
- func (r *Rectangle) NearlyEqual(other *Rectangle, eps float64) bool
- func (r *Rectangle) PDF(w io.Writer) error
- func (r *Rectangle) String() string
- func (r *Rectangle) XPos(rel float64) float64
- func (r *Rectangle) YPos(rel float64) float64
- type Reference
- type Res
- type Resource
- type Resources
- type Stream
- type String
- type Version
- type VersionError
- type Writer
- func (pdf *Writer) Alloc() Reference
- func (pdf *Writer) AutoClose(obj io.Closer)
- func (pdf *Writer) Close() error
- func (pdf *Writer) GetMeta() *MetaInfo
- func (pdf *Writer) OpenStream(ref Reference, dict Dict, filters ...Filter) (io.WriteCloser, error)
- func (pdf *Writer) Put(ref Reference, obj Object) error
- func (pdf *Writer) WriteCompressed(refs []Reference, objects ...Object) error
- type WriterOptions
Constants ¶
const ( // ErrorHandlingRecover means that the reader will try to recover from // errors and continue parsing the file. This is the default. // // This guarantees that the reader will return a valid Catalog object, // with a non-null Pages field. ErrorHandlingRecover = iota // ErrorHandlingReport means that the reader will try to recover from // errors and continue parsing the file, but will report errors to the // caller. // // This mode tolerates more errors than ErrorHandlingRecover does. // In particular, it is not guaranteed that there are any pages in the // document. ErrorHandlingReport // ErrorHandlingStop means that the reader will stop parsing the file as // soon as an error is encountered. ErrorHandlingStop )
Variables ¶
var ( GetArray = resolveAndCast[Array] GetBoolean = resolveAndCast[Boolean] GetDict = resolveAndCast[Dict] GetInteger = resolveAndCast[Integer] GetName = resolveAndCast[Name] GetReal = resolveAndCast[Real] GetStream = resolveAndCast[*Stream] GetString = resolveAndCast[String] )
Helper functions for getting objects of a specific type. Each of these functions calls Resolve on the object before attempting to convert it to the desired type. If the object is `null`, a zero object is returned witout error. If the object is of the wrong type, an error is returned.
The signature of these functions is
func GetT(r Getter, obj Object) (x T, err error)
where T is the type of the object to be returned.
Functions ¶
func CheckVersion ¶ added in v0.3.3
CheckVersion checks whether the PDF file being written has version minVersion or later. If the version is new enough, nil is returned. Otherwise a VersionError for the given operation is returned.
func DecodeDict ¶ added in v0.3.3
DecodeDict initialises a struct using the data from a PDF dictionary. The argument dst must be a pointer to a struct, or the function will panic.
Go struct tags can be used to control the decoding process. The following tags are supported:
- "optional": the field is optional and may be omitted from the PDF dictionary. Omitted fields default to the Go zero value for the field type.
- "text string": the field is a string which should be encoded as a PDF text string.
- "allowstring": the field is a Name, but the PDF dictionary may contain a String instead. If a String is found, it will be converted to a Name.
- "extra": the field is a map[string]string which contains all entries in the PDF dictionary which are not otherwise decoded.
This function is the converse of AsDict.
func DecodeStream ¶ added in v0.3.5
DecodeStream returns a reader for the decoded stream data. If numFilters is non-zero, only the first numFilters filters are decoded.
func Format ¶ added in v0.3.4
Format formats a PDF object as a string, in the same way as the it would be written to a PDF file.
func IsMalformed ¶ added in v0.4.0
Types ¶
type AuthenticationError ¶
type AuthenticationError struct {
ID []byte
}
AuthenticationError indicates that authentication failed because the correct password has not been supplied.
func (*AuthenticationError) Error ¶
func (err *AuthenticationError) Error() string
type Catalog ¶
type Catalog struct { Version Version `pdf:"optional"` Extensions Object `pdf:"optional"` Pages Reference PageLabels Object `pdf:"optional"` Names Object `pdf:"optional"` Dests Object `pdf:"optional"` ViewerPreferences Object `pdf:"optional"` PageLayout Name `pdf:"optional"` PageMode Name `pdf:"optional"` Outlines Reference `pdf:"optional"` Threads Reference `pdf:"optional"` OpenAction Object `pdf:"optional"` AA Object `pdf:"optional"` URI Object `pdf:"optional"` AcroForm Object `pdf:"optional"` MetaData Reference `pdf:"optional"` StructTreeRoot Object `pdf:"optional"` MarkInfo Object `pdf:"optional"` Lang language.Tag `pdf:"optional"` SpiderInfo Object `pdf:"optional"` OutputIntents Object `pdf:"optional"` PieceInfo Object `pdf:"optional"` OCProperties Object `pdf:"optional"` Perms Object `pdf:"optional"` Legal Object `pdf:"optional"` Requirements Object `pdf:"optional"` Collection Object `pdf:"optional"` NeedsRendering bool `pdf:"optional"` // contains filtered or unexported fields }
Catalog represents a PDF Document Catalog. The only required field in this structure is Pages, which specifies the root of the page tree. This struct can be used with the DecodeDict and AsDict functions.
The Document Catalog is documented in section 7.7.2 of PDF 32000-1:2008.
type Data ¶ added in v0.3.0
type Data struct {
// contains filtered or unexported fields
}
Data is an in-memory representation of a PDF document.
func Read ¶ added in v0.3.0
func Read(r io.ReadSeeker, opt *ReaderOptions) (*Data, error)
Read reads a complete PDF document into memory.
func (*Data) OpenStream ¶ added in v0.3.3
type Dict ¶
Dict represent a Dictionary object in a PDF file.
func AsDict ¶
func AsDict(s interface{}) Dict
AsDict creates a PDF Dict object, encoding the fields of a Go struct. This is the converse of DecodeDict.
func GetDictTyped ¶ added in v0.3.5
GetDictTyped resolves any indirect reference and checks that the resulting object is a dictionary. The function also checks that the "Type" entry of the dictionary, if set, is equal to the given type.
type FileInfo ¶ added in v0.2.0
type FileInfo struct { R io.ReadSeeker FileSize int64 PDFStart int64 PDFEnd int64 HeaderVersion string Sections []*FileSection }
func SequentialScan ¶ added in v0.2.0
func SequentialScan(r io.ReadSeeker) (*FileInfo, error)
SequentialScan reads a PDF file sequentially, extracting information about the file structure and the location of indirect objects. This can be used to attempt to read damaged PDF files, in particular in cases where the cross-reference table is missing or corrupt.
func (*FileInfo) MakeReader ¶ added in v0.2.0
func (fi *FileInfo) MakeReader(opt *ReaderOptions) (*Reader, error)
type FileObject ¶ added in v0.2.0
type FileSection ¶ added in v0.2.0
type FileSection struct { XRefPos int64 TrailerPos int64 StartXRefPos int64 EOFPos int64 Objects []*FileObject Catalog *FileObject ObjectStreams []*FileObject }
TODO(voss): add start and end offsets
type Filter ¶ added in v0.3.3
type Filter interface { // Info returns the name and parameters of the filter, // as they should be written to the PDF file. Info(Version) (Name, Dict, error) // Encode returns a writer which encodes data written to it. // The returned writer must be closed after use. Encode(Version, io.WriteCloser) (io.WriteCloser, error) // Decode returns a reader which decodes data read from it. Decode(Version, io.Reader) (io.Reader, error) }
Filter represents a PDF stream filter.
Currently, the following filter types are implemented by this library: FilterASCII85, FilterFlate, FilterLZW. In addition, FilterCompress can be used to select the best available compression filter when writing PDF streams. This is FilterFlate for PDF versions 1.2 and above, and FilterLZW for older versions.
type FilterASCII85 ¶ added in v0.3.3
type FilterASCII85 struct{}
FilterASCII85 is the ASCII85Decode filter. This filter has no parameters.
func (FilterASCII85) Encode ¶ added in v0.3.3
func (f FilterASCII85) Encode(_ Version, w io.WriteCloser) (io.WriteCloser, error)
Encode implements the Filter interface.
type FilterCompress ¶ added in v0.3.3
type FilterCompress Dict
FilterCompress is a special filter name, which is used to select the best available compression filter when writing PDF streams. This is FilterFlate for PDF versions 1.2 and above, and FilterLZW for older versions.
func (FilterCompress) Encode ¶ added in v0.3.3
func (f FilterCompress) Encode(v Version, w io.WriteCloser) (io.WriteCloser, error)
Encode implements the Filter interface.
type FilterFlate ¶ added in v0.3.3
type FilterFlate Dict
FilterFlate is the FlateDecode filter.
The filter is represented by a dictionary of tiler parameters. The following parameters are supported:
"Predictor": A code that selects the predictor algorithm, if any. If the value is greater than 1, the data were differenced before being encoded. (Default: 1)
"Colors": The number of interleaved color components per sample. (Default: 1)
"BitsPerComponent": The number of bits used to represent each color. (Default: 8)
"Columns": The number of samples in each row. (Default: 1)
The parameters are explained in detail in section 7.4.4 of PDF 32000-1:2008.
This filter requires PDF versions 1.2 or higher.
func (FilterFlate) Encode ¶ added in v0.3.3
func (f FilterFlate) Encode(v Version, w io.WriteCloser) (io.WriteCloser, error)
Encode implements the Filter interface.
type FilterLZW ¶ added in v0.3.3
type FilterLZW Dict
FilterLZW is the LZWDecode filter. This is only useful to read legacy PDF files. For new files, use FilterFlate instead.
The filter is represented by a dictionary of tiler parameters. The following parameters are supported:
"Predictor": A code that selects the predictor algorithm, if any. If the value is greater than 1, the data were differenced before being encoded. (Default: 1)
"Colors": The number of interleaved color components per sample. (Default: 1)
"BitsPerComponent": The number of bits used to represent each color. (Default: 8)
"Columns": The number of samples in each row. (Default: 1)
"EarlyChange": An integer value specifying whether the data is encoded using the correct LZW algorithm (value 0), or whether code with an off-by-one error is used (value 1). (Default: 1)
The parameters are explained in detail in section 7.4.4 of PDF 32000-1:2008.
func (FilterLZW) Encode ¶ added in v0.3.3
func (f FilterLZW) Encode(v Version, w io.WriteCloser) (io.WriteCloser, error)
Encode implements the Filter interface.
type Info ¶
type Info struct { Title string `pdf:"text string,optional"` Author string `pdf:"text string,optional"` Subject string `pdf:"text string,optional"` Keywords string `pdf:"text string,optional"` // Creator gives the name of the application that created the original // document, if the document was converted to PDF from another format. Creator string `pdf:"text string,optional"` // Producer gives the name of the application that converted the document, // if the document was converted to PDF from another format. Producer string `pdf:"text string,optional"` // CreationDate gives the date and time the document was created. CreationDate time.Time `pdf:"optional"` // ModDate gives the date and time the document was most recently modified. ModDate time.Time `pdf:"optional"` // Trapped indicates whether the document has been modified to include // trapping information. (A trap is an overlap between adjacent areas of // of different colours, used to avoid visual problems caused by imprecise // alignment of different layers of ink.) Possible values are: // * "True": The document has been fully trapped. No further trapping is // necessary. // * "False": The document has not been trapped. // * "Unknown" (default): Either it is unknown whether the document has // been trapped, or the document has been partially trapped. Further // trapping may be necessary. Trapped Name `pdf:"optional,allowstring"` // Custom contains all non-standard fields in the Info dictionary. Custom map[string]string `pdf:"extra"` }
Info represents a PDF Document Information Dictionary. All fields in this structure are optional.
The Document Information Dictionary is documented in section 14.3.3 of PDF 32000-1:2008.
type MalformedFileError ¶
MalformedFileError indicates that a PDF file could not be parsed.
func (*MalformedFileError) Error ¶
func (err *MalformedFileError) Error() string
func (*MalformedFileError) Unwrap ¶
func (err *MalformedFileError) Unwrap() error
type MetaInfo ¶ added in v0.3.3
type MetaInfo struct { // Version is the PDF version used in this file. Version Version // The ID of the file. This is either a slice of two byte slices (the // original ID of the file, and the ID of the current version), or nil if // the file does not specify an ID. ID [][]byte // Catalog is the document catalog for this file. Catalog *Catalog // Info is the document information dictionary for this file. // This is nil if the file does not contain a document information // dictionary. Info *Info // Trailer is the trailer dictionary for the file. // All entries related to the cross-reference table have been removed. Trailer Dict }
MetaInfo represents the meta information of a PDF file.
type Name ¶
type Name string
Name represents a name object in a PDF file.
type Number ¶
type Number float64
A Number is either an Integer or a Real.
type Object ¶
type Object interface { // PDF writes the PDF file representation of the object to w. PDF(w io.Writer) error }
Object represents an object in a PDF file. There are nine basic types of PDF objects, which implement this interface: Array, Boolean, Dict, Integer, Name, Real, Reference, *Stream, and String. Custom types can be constructed out of these basic types, by implementing the Object interface.
func Resolve ¶ added in v0.3.1
Resolve resolves references to indirect objects.
If obj is a Reference, the function reads the corresponding object from the file and returns the result. If obj is not a Reference, it is returned unchanged. The function recursively follows chains of references until it resolves to a non-reference object.
If a reference loop is encountered, the function returns an error of type MalformedFileError.
TODO(voss): rename to "Get"?
type Perm ¶
type Perm int
Perm describes which operations are permitted when accessing the document with User access (but not Owner access). The user can always view the document.
This library just reports the permissions as specified in the PDF file. It is up to the caller to enforce the permissions.
const ( // PermCopy allows to extract text and graphics. PermCopy Perm = 1 << iota // PermPrintDegraded allows printing of a low-level representation of the // appearance, possibly of degraded quality. PermPrintDegraded // PermPrint allows printing a representation from which a faithful digital // copy of the PDF content could be generated. This implies // PermPrintDegraded. PermPrint // PermForms allows to fill in form fields, including signature fields. PermForms // PermAnnotate allows to add or modify text annotations. This implies // PermForms. PermAnnotate // PermAssemble allows to insert, rotate, or delete pages and to create // bookmarks or thumbnail images. PermAssemble // PermModify allows to modify the document. This implies PermAssemble. PermModify // PermAll gives the user all permissions, making User access equivalent to // Owner access. PermAll = permNext - 1 )
type Placeholder ¶
type Placeholder struct {
// contains filtered or unexported fields
}
A Placeholder is a space reserved in a PDF file that can later be filled with a value. One common use case is to store the length of compressed content in a PDF stream dictionary. To create Placeholder objects, use the [Writer.NewPlaceholder] method.
func NewPlaceholder ¶ added in v0.3.3
func NewPlaceholder(pdf Putter, size int) *Placeholder
NewPlaceholder creates a new placeholder for a value which is not yet known. The argument size must be an upper bound to the length of the replacement text. Once the value becomes known, it can be filled in using the Placeholder.Set method.
func (*Placeholder) PDF ¶
func (x *Placeholder) PDF(w io.Writer) error
PDF implements the Object interface.
func (*Placeholder) Set ¶
func (x *Placeholder) Set(val Object) error
Set fills in the value of the placeholder object. This should be called as soon as possible after the value becomes known.
type Putter ¶ added in v0.3.3
type Putter interface { Close() error GetMeta() *MetaInfo Alloc() Reference Put(ref Reference, obj Object) error OpenStream(ref Reference, dict Dict, filters ...Filter) (io.WriteCloser, error) // TODO(voss): allow to set the object ID for the containing stream? WriteCompressed(refs []Reference, objects ...Object) error AutoClose(obj io.Closer) }
TODO(voss): find a better name for this
type Reader ¶
type Reader struct { // Errors is a list of errors encountered while opening the file. // This is only used if the ErrorHandling option is set to // ErrorHandlingReport. Errors []*MalformedFileError // contains filtered or unexported fields }
Reader represents a pdf file opened for reading. Use Open or NewReader to create a Reader.
func NewReader ¶
func NewReader(data io.ReadSeeker, opt *ReaderOptions) (*Reader, error)
NewReader creates a new Reader object.
func Open ¶
func Open(fname string, opt *ReaderOptions) (*Reader, error)
Open opens the named PDF file for reading. After use, Reader.Close must be called to close the file the Reader is reading from.
func (*Reader) Authenticate ¶ added in v0.3.1
Authenticate tries to authenticate the actions given in perm. If a password is required, this calls the ReadPassword function specified in the ReaderOptions struct. The return value is nil if the owner was authenticated (or if no authentication is required), and an object of type AuthenticationError if the required password was not supplied.
func (*Reader) AuthenticateOwner ¶
AuthenticateOwner tries to authenticate the owner of a document. If a password is required, this calls the ReadPassword function specified in the ReaderOptions struct. The return value is nil if the owner was authenticated (or if no authentication is required), and an object of type AuthenticationError if the required password was not supplied.
func (*Reader) Close ¶
Close closes the Reader.
This call only has an effect if the Reader was created by Open.
func (*Reader) Get ¶ added in v0.3.0
Get reads an indirect object from the PDF file. If the object is not present, nil is returned without an error.
The argument canObjStm specifies whether the object may be read from an object stream. Normally, this should be set to true. If canObjStm is false and the object is in an object stream, an error is returned.
type ReaderErrorHandling ¶ added in v0.3.1
type ReaderErrorHandling int
type ReaderOptions ¶ added in v0.2.0
type ReaderOptions struct { // ReadPassword is a function that queries the user for a password for the // document with the given ID. The function is called repeatedly, with // sequentially increasing values of try (starting at 0), until the correct // password is entered. If the function returns the empty string, the // authentication attempt is aborted and [AuthenticationError] is reported // to the caller. ReadPassword func(ID []byte, try int) string ErrorHandling ReaderErrorHandling }
ReaderOptions provides additional information for opening a PDF file.
type Rectangle ¶
type Rectangle struct {
LLx, LLy, URx, URy float64
}
Rectangle represents a PDF rectangle.
func GetRectangle ¶ added in v0.3.1
GetRectangle resolves references to indirect objects and makes sure the resulting object is a PDF rectangle object. If the object is null, nil is returned.
func (*Rectangle) NearlyEqual ¶
NearlyEqual reports whether the corner coordinates of two rectangles differ by less than `eps`.
type Reference ¶
type Reference uint64
Reference represents a reference to an indirect object in a PDF file. The lowest 32 bits represent the object number, the next 16 bits the generation number.
func NewInternalReference ¶ added in v0.4.0
NewInternalReference creates a new reference object which is guaranteed not to clash with an existing reference in the PDF file.
func NewReference ¶ added in v0.2.0
NewReference creates a new reference object.
func (Reference) Generation ¶
Generation returns the generation number of the reference.
func (Reference) IsInternal ¶ added in v0.4.0
IsInternal returns true if the reference is an internal reference.
type Res ¶ added in v0.4.1
Res can be embedded in a struct to implement the Resource interface.
func (Res) DefaultName ¶ added in v0.4.1
DefaultName implements the Resource interface.
type Resource ¶
type Resource interface { DefaultName() Name // return "" to choose names automatically PDFObject() Object // value to use in the resource dictionary }
Resource is a PDF resource inside a content stream.
type Resources ¶
type Resources struct { ExtGState Dict `pdf:"optional"` // maps resource names to graphics state parameter dictionaries ColorSpace Dict `pdf:"optional"` // maps resource names to colour spaces Pattern Dict `pdf:"optional"` // maps resource names to pattern objects Shading Dict `pdf:"optional"` // maps resource names to shading dictionaries XObject Dict `pdf:"optional"` // maps resource names to external objects Font Dict `pdf:"optional"` // maps resource names to font dictionaries ProcSet Array `pdf:"optional"` // predefined procedure set names Properties Dict `pdf:"optional"` // maps resource names to property list dictionaries for marked content }
Resources describes a PDF Resource Dictionary.
See section 7.8.3 of PDF 32000-1:2008 for details.
type String ¶
type String []byte
String represents a raw string in a PDF file. The character set encoding, if any, is determined by the context.
func ParseString ¶
ParseString parses a string from the given buffer. The buffer must include the surrounding parentheses or angle brackets.
func TextString ¶
TextString creates a String object using the "text string" encoding, i.e. using either UTF-16BE encoding (with a BOM) or PdfDocEncoding.
func (String) AsDate ¶
AsDate converts a PDF date string to a time.Time object. If the string does not have the correct format, an error is returned.
func (String) AsTextString ¶
AsTextString interprets x as a PDF "text string" and returns the corresponding utf-8 encoded string.
type Version ¶
type Version int
Version represents a version of PDF standard.
const ( V1_0 Version V1_1 V1_2 V1_3 V1_4 V1_5 V1_6 V1_7 V2_0 )
PDF versions supported by this library.
func GetVersion ¶ added in v0.3.5
func ParseVersion ¶
ParseVersion parses a PDF version string.
type VersionError ¶
VersionError is returned when trying to use a feature in a PDF file which is not supported by the PDF version used. Use CheckVersion to create VersionError objects.
func (*VersionError) Error ¶
func (err *VersionError) Error() string
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer represents a PDF file open for writing. Use Create or NewWriter to create a new Writer.
func Create ¶
func Create(name string, v Version, opt *WriterOptions) (*Writer, error)
Create creates a PDF file with the given name and opens it for output. If a file with the same name already exists, it will be overwritten.
After writing the content to the file, Writer.Close must be called to write the PDF trailer and close the underlying file.
func NewWriter ¶
NewWriter prepares a PDF file for writing, using the provided io.Writer.
After writing the content to the file, Writer.Close must be called to write the PDF trailer.
func (*Writer) AutoClose ¶ added in v0.2.0
AutoClose registers an object to be automatically closed when the PDF file is closed. Only one object can be registered for each key, and objects are closed in ascending order of their keys.
func (*Writer) Close ¶
Close closes the Writer, flushing any unwritten data to the underlying io.Writer.
func (*Writer) OpenStream ¶
OpenStream adds a PDF Stream to the file and returns an io.Writer which can be used to add the stream's data. No other objects can be added to the file until the stream is closed.
func (*Writer) Put ¶ added in v0.3.0
Put writes an indirect object to the PDF file, using the given reference.
func (*Writer) WriteCompressed ¶
WriteCompressed writes a number of objects to the file as a compressed object stream.
Object streams are only available for PDF version 1.5 and newer; in case the file version is too low, the objects are written directly into the PDF file, without compression.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
examples
|
|
font/cff-glyphs
Read a CFF font and display a magnified version of each glyph in a PDF file.
|
Read a CFF font and display a magnified version of each glyph in a PDF file. |
Package font implements the foundations of PDF font handling.
|
Package font implements the foundations of PDF font handling. |
cff
Package cff implements CFF font data embedded into PDF files.
|
Package cff implements CFF font data embedded into PDF files. |
cmap
Package cmap implements CMap files for embedding in PDF files.
|
Package cmap implements CMap files for embedding in PDF files. |
embed
Package embed provides convenience functions to embed fonts into a PDF file.
|
Package embed provides convenience functions to embed fonts into a PDF file. |
opentype
Package opentype implements OpenType fonts embedded into PDF files.
|
Package opentype implements OpenType fonts embedded into PDF files. |
truetype
Package truetype implements TrueType fonts embedded into PDF files.
|
Package truetype implements TrueType fonts embedded into PDF files. |
type1
Package type1 implements Type 1 fonts embedded into PDF files.
|
Package type1 implements Type 1 fonts embedded into PDF files. |
type3
Package type3 implements Type 3 fonts embedded into PDF files.
|
Package type3 implements Type 3 fonts embedded into PDF files. |
Package graphics allows to write PDF content streams.
|
Package graphics allows to write PDF content streams. |
color
Package color implements the PDF color spaces and colors.
|
Package color implements the PDF color spaces and colors. |
form
Package form implements PDF form XObjects.
|
Package form implements PDF form XObjects. |
internal
|
|
Package lzw implements the Lempel-Ziv-Welch compressed data format.
|
Package lzw implements the Lempel-Ziv-Welch compressed data format. |
Package numtree implements PDF number trees.
|
Package numtree implements PDF number trees. |
Package pagetree implements PDF page trees.
|
Package pagetree implements PDF page trees. |