-
Notifications
You must be signed in to change notification settings - Fork 8
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 a polka/express implementation #6
Comments
Hello! Can you explain what do you mean by "bind this client to a express server"? There is example in README, how you can send PDF file to client from Express server: app.get('/pdf', function(req, res) {
//...
pdf.pipe(res)
}) And I don't quite understand, what is "wrap the renderd html on a pdf file"? Can you explain step-by-step, how do you see it, please? |
Thanks for the quick reply! Oh right, the express example should match as polka is based on express. 👍
I have this link: I would like I also use Sapper middleware and I'm quite confuse about how I should make this working. 🤔 |
I've never used Sapper, so I made a quick investigation. I guess you can add your own middleware, right before But I cannot tell, how to return PDF from Sapper middleware... As far as I can tell from its source code — it never calls Here is what I tried, you can dig in that direction, maybe you will succeed: |
Hah! I made it with a little kinda hack — immediately replace |
To have styles, you should also add them to gotenberg, as sources. Looks like sapper generates them dynamically, so, this is whole another task to get links to styles from HTML content, and add those styles to gotenberg. And I doubt it should be documented, this is quite specific use case, in my opinion... |
Wow, I'm impress by your POC! I'll look at that and try my integration ASAP! Thanks a lot! 👍
Maybe not directly on the README, but maybe a cookbook section? I would enjoy to add my contribution if I manage to make something right with this method. 😉 |
Is your project open source? I think I can add links to projects, which are using this library, somewhere... |
Unfortunately, not this one. Your PasteBin works great, but it's a lot of setup just to convert a page to a4 pdf format. Don't you think some parts of your script may be provided by your library? 🤔 The goal would be to simplify the integration, and make the users happier. 👍 |
Hm. There are only 13 rows, related to PDF converting (including I can think of something like Gotenberg Express middleware, which will convert responses to PDF on the fly, but this definitely should be external package. Which could use my library :) I don't think this should be in this client, I like Unix philosophy, when one tool do one thing and do it well :) But I'll mark this idea with middleware in my list :) |
Subject
It would be useful to have one example of how to bind this client to a polka and/or express server.
A complete example with a url extension matching
.pdf
would be enough for a good demo.Concrete case
I use the Sapper framework which has ssr rendering.
I can create a
.pdf.svelte
route with html rendering.I would like to match this kind of route to wrap the renderd html on a pdf file.
The text was updated successfully, but these errors were encountered: