Comments (8)
Thanks, I totally agree. To do that, I can think of three possible options:
-
Modify the PDF with a separate library after Chrome has rendered.
-
Check if Puppeteer/Chrome print protocol would allow injecting headers and footers in a more custom way. I doubt this is supported, but haven't checked.
Out of these options, I'd recommend to investigate the first one. I'm not so excited about the second option.
from url-to-pdf-api.
@webular assuming you control how the HTML for those pages is generated, why don't you add the header/footer to the HTML using something like a template language (e.g. Jinja, Twig,..), a bit how you would handle email templates.
from url-to-pdf-api.
@fabiosussetto I do control the html. But I find it nontrivial - at the least I don't have much experience with this. I'm open to direction -- All I really need is to add a logo and project name, and page number at the top of every generated PDF. I'd also need to add a one line footer to each page. Got any examples you can point me to on doing this with email templates like you suggest?
I'm really pleased to see the traction this project has received and would love to make the switch.
from url-to-pdf-api.
With Puppeteer 1.0.0 it is now possible to add a custom header/footer (source). This repo currently uses ^0.11.0, so after an update it might work :).
from url-to-pdf-api.
Made a PR #56 to upgrade to v1.0.0, which would fix this issue 😃.
from url-to-pdf-api.
The support for this is now in master, and also released to the demo Heroku app. However there are some caveats with Chrome's footer and header support. See #77
from url-to-pdf-api.
I found puppeteer is a good tool for converting from html to pdf.
But the footerTemplate must be the same on all pages?
Now I need, for example, pages' footer like this:
(page 1)
pageNumber of totalNumber---------------------------vocabulary list
(page 2)
vocabulary list-------------------------------------pageNumber of totalNumber
(page 3)
pageNumber of totalNumber---------------------------vocabulary list
I prepare 2 Templates for odd and even num pages
What should i do?
from url-to-pdf-api.
@RayAnti2 you can using page_script, I hope this help u
from url-to-pdf-api.
Related Issues (20)
- Encoded URI's not accepted in GET "url" parameter
- selector for PDF like screenshot.selector query
- Procfile not working out of the box with Dokku
- PDF name is always "render" can we change it? HOT 2
- jpeg screenshot with selector
- Are get links allowed ? HOT 3
- pdf.fullPage=true is not working in Demo
- Why bluebird?
- Cloudflare protection HOT 1
- Application error HOT 3
- width and height and screen size in api URL HOT 1
- Is there a way to make only 1 page landscape but the rest portrait? HOT 1
- Potential security issue HOT 1
- Still Availabe? HOT 2
- Docs don't provide information about Adding Header/Footer to API service HOT 1
- Page break is not working properly HOT 3
- Some web pages display completion
- Updating puppeteer to support newer Chrome features HOT 4
- Basic Auth is not forwarded
- Footer and Header Template HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from url-to-pdf-api.