mirror of
https://github.com/unidoc/unipdf.git
synced 2025-05-01 22:17:29 +08:00
24 lines
540 B
Go
24 lines
540 B
Go
![]() |
package extractor
|
||
|
|
||
|
import "github.com/unidoc/unidoc/pdf/model"
|
||
|
|
||
|
// Extractor stores and offers functionality for extracting content from PDF pages.
|
||
|
type Extractor struct {
|
||
|
contents string
|
||
|
resources *model.PdfPageResources
|
||
|
}
|
||
|
|
||
|
// New returns an Extractor instance for extracting content from the input PDF page.
|
||
|
func New(page *model.PdfPage) (*Extractor, error) {
|
||
|
contents, err := page.GetAllContentStreams()
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
e := &Extractor{}
|
||
|
e.contents = contents
|
||
|
e.resources = page.Resources
|
||
|
|
||
|
return e, nil
|
||
|
}
|