diff --git a/internal/app/api/api.go b/internal/app/api/api.go index cba0a3d5..37652ba3 100644 --- a/internal/app/api/api.go +++ b/internal/app/api/api.go @@ -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 } diff --git a/internal/app/api/merge.go b/internal/app/api/merge.go index d79d825e..2f3aa403 100644 --- a/internal/app/api/merge.go +++ b/internal/app/api/merge.go @@ -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 } diff --git a/internal/pkg/printer/doc.go b/internal/pkg/printer/doc.go index 21d6d8ea..473019df 100644 --- a/internal/pkg/printer/doc.go +++ b/internal/pkg/printer/doc.go @@ -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