-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add export options #9
Comments
Yes! I don't know the best way to do this yet but totally agree with this 😊 I attempted to detach the DSL as far away from SwiftUI as I could so that a PDF or HTML or whatever could be generated from the I might still use SwiftUI to generate the PDF but I also might not but I would love this feature! |
I can prototype something. |
I'd be fine with limiting the PDF export to macOS 13 and iOS16 if its much easier 😇 |
I made some digging here and prototyped approach described above. I believe this not gonna work because of the following reasons:
I think we need to write own render engine for DSL with the help of |
Thanks for an awesome library! :-) Yesterday we held a local Swift Developer meetup in Aarhus, Denmark - and I used DeckUI for my presentations. :-) It was a really good experience - I made a small Playground app on my iPad and presented my slides from there - and exported it to the mac to have a backup for presenting from there. Today I wanted to share the slides - and while sharing the code is also fun, I thought I would have a go at PDF generation. My shot at this included:
func render() -> URL {
let url = URL.documentsDirectory.appending(path: "output.pdf")
var box = CGRect(x: 0, y: 0, width: 1366, height: 1024)
guard let pdf = CGContext(url as CFURL, mediaBox: &box, nil) else {
return url
}
for index in 0..<deck.slideCount {
let renderer = ImageRenderer(content:
Presenter(deck: deck,
defaultResolution: (width: 1366, height: 1024),
showCamera: false,
index: .constant(index)
)
.frame(width: 1366, height: 1024)
.preferredColorScheme(.dark)
.colorScheme(.dark)
)
renderer.render { size, context in
pdf.beginPDFPage(nil)
context(pdf)
pdf.endPDFPage()
}
}
pdf.closePDF()
return url
}
It can likely be optimized to not having to recreate the Presenter on each iteration of the loop and instead have this functionality internally. I'd love to help implementing this feature into the library. I don't know if any of the contributors have ideas about how to handle stuff like the ScrollView disabling... |
I think it would be nice to be able to export the deck to a PDF to share after the presentation with people.
The text was updated successfully, but these errors were encountered: