Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

printing - CSS Scale image to printer paper type?

I have a website that does invoice creation, these are in the form of images 800px wide. The invoices are intended to be printed on 4" continuous feed paper (kind of like receipt printers at the store).

I'm currently playing around with width and margin CSS settings like this:

@media print {
    .invoice-image {
        width: 425px;
        margin-left: -50px;
    }
}

Adjusting the width and margins doesn't seem ideal. Especially since I have to push to QA each time (which is a 5 minute wait) to see the results of my changes due to the printers only working with the iPads. Is there an easier way for me to scale the image as needed to the size of the paper? Something like view-port maybe?

question from:https://stackoverflow.com/questions/66050734/css-scale-image-to-printer-paper-type

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...