fixing/simplifying godoc

This commit is contained in:
Julien Neuhart
2018-12-13 17:06:29 +01:00
parent 2cedcecc38
commit 404535c512
3 changed files with 4 additions and 49 deletions

View File

@@ -94,7 +94,7 @@ func print(c echo.Context, p printer.Printer, r *resource) error {
if r.webhookURL() == "" {
// if no webhook URL given, run conversion
// and directly return the resulting PDF file
// or and error.
// or an error.
if err := p.Print(fpath); err != nil {
return err
}

View File

@@ -29,7 +29,7 @@ func merge(c echo.Context) error {
if r.webhookURL() == "" {
// if no webhook URL given, run merge
// and directly return the resulting PDF file
// or and error.
// or an error.
if err := printer.Merge(fpaths, fpath); err != nil {
return err
}

View File

@@ -1,52 +1,7 @@
/*
Package printer contains structs which convert
a specific file type to PDF:
a specific file type to PDF.
// converting HTML to PDF.
p := &printer.HTML{
Context: context.Background(),
PaperWidth: 8.27,
PaperHeight: 11.7,
Landscape: false,
}
p.WithLocalURL("index.html")
if err := p.Print("result.pdf"); err != nil {
return err
}
// converting Markdown to PDF:
// it assumes here that our template "index.html"
// will call toHTML method to convert
// markdown files to HTML.
p := &printer.Markdown{
Context: context.Background(),
TemplatePath: "index.html",
PaperWidth: 8.27,
PaperHeight: 11.7,
Landscape: false,
}
if err := p.Print("result.pdf"); err != nil {
return err
}
// converting Office documents to PDF:
// it converts each files independently and
// then merge them.
//
// Also, as unoconv cannot perform
// concurrent conversions, a lock is applied.
p := &printer.Office{
Context: ctx,
FilePaths: []string{"document.docx", "presentation.pptx"}
}
if err := p.Print("result.pdf"); err != nil {
return err
}
It is also able to merge a list of PDF files:
if err := printer.Merge([]string{"foo.pdf", "bar.pdf"}, "result.pdf"); err != nil {
return err
}
It is also able to merge a list of PDF files.
*/
package printer