Comments (6)
Here is an example of what you can do:
// set up the document
HtmlToPdfDocument doc = new HtmlToPdfDocument()
{
GlobalSettings = {
PaperSize = PaperKind.A4,
Orientation = Orientation.Portrait,
Margins = new MarginSettings() { Top = 10, Left = 10, Right = 10 },
},
};
// add object settings to the document
foreach (var item in items)
{
var page = new ObjectSettings()
{
PagesCount = true,
WebSettings = { DefaultEncoding = "utf-8" },
HtmlContent = item
};
doc.Objects.Add(page);
}
//convert
var pdf = _converter.Convert(doc);
This covers your use case?
from dinktopdf.
Can you provide more details what you want to achieve - maybe an example.
from dinktopdf.
Example: set list ObjectSettings to Objects - create multiple pages dynamic
List<ObjectSettings> pages = new List<ObjectSettings>();
foreach (var item in items)
{
var page = new ObjectSettings() {
PagesCount = true,
WebSettings = { DefaultEncoding = "utf-8" },
HtmlContent = @"<h5>item.Name</h5>"
};
pages.Add(page);
}
var doc = new HtmlToPdfDocument()
{
GlobalSettings = {
PaperSize = PaperKind.A4,
Orientation = Orientation.Portrait,
Margins = new MarginSettings() { Top = 10, Left = 10, Right = 10 },
},
Objects = pages;
};
byte[] pdf = _converter.Convert(doc);
from dinktopdf.
Thank you!
from dinktopdf.
Thank you, God Bless!
from dinktopdf.
HI @rdvojmoc , I am trying to add multiple pages, but after the first page, subsequent pages are printed blank. Any idea how can this be solved?
from dinktopdf.
Related Issues (20)
- not showing page number in docker container
- Unable to give page border with radius. Is there any way?
- Incorrect page number in the footer displayed
- bootstrap format in html partial view HOT 1
- Not able to convert math related symbols
- It is possible to use html footer with page number ?
- nodejs : Depends: libc6 (>= 2.28) but 2.24-11+deb9u4 is to be installed
- css flex not working HOT 4
- I can't generate on a second request HOT 3
- Erro docker linux HOT 2
- Including image in the footer
- HTML tags removed HOT 1
- libwkhtmltox.dylib for mac M1 chip HOT 1
- One or more errors occurred. (Unable to load shared library 'libwkhtmltox' or one of its dependencies HOT 3
- Can't convert Page url to Pdf on Linux HOT 2
- How can I add background-image?
- Footer not working when there is an image
- Docker Image Error on arm64 Linux EC2 Instance HOT 2
- Outline of globalsetting is not working
- library not loading correctly
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 dinktopdf.