Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ExtMap = map[string]ExtConst{ "application/pdf": PDF, "text/plain": OFFICE, "application/rtf": OFFICE, "application/vnd.oasis.opendocument.text-template": OFFICE, "application/msword": OFFICE, "application/vnd.openxmlformats-officedocument.wordprocessingml.document": OFFICE, "application/vnd.oasis.opendocument.text": OFFICE, "application/vnd.ms-excel": OFFICE, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": OFFICE, "application/vnd.oasis.opendocument.spreadsheet": OFFICE, "application/vnd.ms-powerpoint": OFFICE, "application/vnd.openxmlformats-officedocument.presentationml.presentation": OFFICE, "application/vnd.oasis.opendocument.presentation": OFFICE, "text/html": URL, }
ExtMap mapps Content-Type to ExtConst
Functions ¶
Types ¶
type ContentExtractor ¶
ContentExtractor is a connector to a tika server and build content lines from file streams
func NewContentExtractor ¶
func NewContentExtractor(httpClient *http.Client, urlString string) *ContentExtractor
NewContentExtractor connects to a tika server at a given address
func (*ContentExtractor) ExtractCSV ¶
func (ce *ContentExtractor) ExtractCSV(ctx context.Context, filecontent io.Reader) ([]types.ContentLine, error)
ExtractCSV process a byte stream assuming it is a type of comma or tab separated values
func (*ContentExtractor) ExtractText ¶
func (ce *ContentExtractor) ExtractText(ctx context.Context, filecontent io.Reader) ([]types.ContentLine, error)
ExtractText process a file stream assuming it is some kind of text file
type ExtConst ¶
type ExtConst int
ExtConst is an enum type indicating how a particular file type is to be processed
const ( // Convertable to PDF OFFICE ExtConst // URL to a website to convert to PDF URL // Already a PDF PDF )
Values of ExtConst
func IdentifyFileAction ¶
IdentifyFileAction generates the ExtConst based on the file header
func MapContentType ¶
MapContentType converts the content type header value to associated ExtConst
type FileConverter ¶
FileConverter is n connector to gotenberg to convert a wide variety of files into pdfs
func NewFileConverter ¶
func NewFileConverter(url string) *FileConverter
NewFileConverter builds new connector to gotenberg server at url
func (*FileConverter) ConvertOffice ¶
func (fc *FileConverter) ConvertOffice(inputName string, in []byte) (out []byte, err error)
ConvertOffice converts many common file types into PDFs
func (*FileConverter) ConvertURL ¶
func (fc *FileConverter) ConvertURL(url string) (out []byte, err error)
ConvertURL produces PDF version of webpage at address