I managed to generate a .pdf file using HTML and CSS. The size of the page is predefined in inches (A4 format). It works great on my computer, but when I run the program on a different computer, the generated file looks different, the pages remain A4, but the layout changes, although both computers have the same resolution and dpi.
Asked
Active
Viewed 342 times
1 Answers
0
Using CSS maintain design for both.
@media print
- for printers
@media screen
- for for computer screens, tablets, smart-phones etc.
@media print{
h1{
color:red;
}
}
@media screen{
h1{
color:blue;
}
}
<h1>Hello</h1>
Click on "Result" in Snippet screen and press "CTRL + P".

Sunil Boricha
- 446
- 3
- 9