-
-
Notifications
You must be signed in to change notification settings - Fork 112
Description
I just finished an adaptation of your pdf generation code over to cogent core: cogentcore/core#1619 and discovered a couple of issues you probably want to fix in canvas:
writer.go:1343
fs := []pdfDict{} -> fs := pdfArray{}
the write function doesn't know how to write a []pdfDict{} and so this silently fails to write the fs when it is needed.
pdf.go:146, 189
if style.FillRule == canvas.EvenOdd {
r.w.Write([]byte("*"))
}
there is no s*
or S*
defined in PDF, so these end up failing to render the stroke element (silently it seems).
I really appreciated your clever design (once I finally figured it out) for how to efficiently handle the peculiar demands of generating the pdf format -- much cleaner than the fpdf package which I also looked at.
I also implemented links to navigate to different parts of the document, and table-of-contents, so if you want to see how those work they are in https://github.com/cogentcore/core/blob/pdf/paint/pdf/links.go -- nav links took me a long time to figure out b/c the docs were really unclear to me -- have to put everything in a separate object basically.
The driving use-case for me is to generate PDF versions of my online publishing platform, e.g., https://compcogneuro.org/basal-ganglia -- you can click on the PDF button now and get a nicely formatted PDF version of the content. All in Go :)
Anyway, thanks again for all your great work on canvas!