Maroto Document Processor #390
Replies: 10 comments 13 replies
-
Привет, Eng |
Beta Was this translation helpful? Give feedback.
-
Id love to have templating in this, we can write custom serializers and let maroto fill in the data. |
Beta Was this translation helpful? Give feedback.
-
Nice to know @icanc0, may you provide an example of what would be good to have in this feature? |
Beta Was this translation helpful? Give feedback.
-
This is a great idea. Generating PDFs from JSON and YML files can be very helpful. |
Beta Was this translation helpful? Give feedback.
-
Hello guys |
Beta Was this translation helpful? Give feedback.
-
it would be amazing! |
Beta Was this translation helpful? Give feedback.
-
We started this implementation: https://docs.google.com/document/d/1DfmeED0Nxt11bwvpZGVK51IE20sP6kCjoqQVrOSVqZE Any ideas? |
Beta Was this translation helpful? Give feedback.
-
Hello! We’ve started implementing the processor and would like to know your opinion about how we are generating the components. As outlined in the RFC, we won’t be converting the document directly into a structure. Instead, we’ll create an interface map and develop components from there. I believe this method has some advantages, as we mentioned in the RFC, but it does add a bit of complexity to the solution. I’d like to hear your feedback on this approach and if you have any suggestions for achieving the benefits we discussed. |
Beta Was this translation helpful? Give feedback.
-
Hi! I really like this idea. For my use case, a short lived command line tool would be most useful, similar to pandoc. I would love to help out in bringing this to life. Perhaps the repository interface could look something like this. type Repository interface {
Get(name string) (map[string]any, error)
Register(name string, t map[string]any) (Repository, error)
Delete(name string) (Repository, error)
Dump() map[string]map[string]any // useful to get all the templates out and save to a folder or smth
} I'm using A simple in memory repo implementation would look like type repository struct {
templates map[string]map[string]any
}
func New(templates map[string]map[string]any) Repository {
return &repository{templates}
}
func (r repository) Get(name string) (map[string]any, error) {
if t, ok := r.templates[name]; ok {
return t, nil
}
return nil, fmt.Errorf("template not found with name: %s", name)
}
func (r *repository) Register(name string, t map[string]any) (Repository, error) {
var next = map[string]map[string]any{}
maps.Copy(next, r.templates)
next[name] = t
return &repository{templates: next}, nil
}
func (r *repository) Delete(name string) (Repository, error) {
var next = map[string]map[string]any{}
maps.Copy(next, r.templates)
delete(next, name)
return &repository{templates: next}, nil
}
func (r *repository) Dump() map[string]map[string]any {
return r.templates
} |
Beta Was this translation helpful? Give feedback.
-
Since the PDF can be generated via an external request, we need to define how the images and other documents used by the Maroto components will be loaded. We’ve outlined some important points on this in the RFC. @zjom I believe that once the images are loaded, they should be stored in a repository. The repository would then be passed as a parameter to the processor, which would use it to generate the PDF. This would allow the processor to access the images without needing to know how they were loaded, addressing the considerations we added in the RFC. What do you think of this approach? |
Beta Was this translation helpful? Give feedback.
-
RFC: https://docs.google.com/document/d/1DfmeED0Nxt11bwvpZGVK51IE20sP6kCjoqQVrOSVqZE
Hello fellows, we are about to create a document processor to generate PDFs by interpreting serialized data as: yml, json or html. I know that there are projects that transform HTML to PDF, but I feel that we can do something simpler and better.
This is just an idea, I would like to evolve this with you.
Beta Was this translation helpful? Give feedback.
All reactions