English 中文(简体)
为什么用图像从超文本生成的PDF消耗量大大高于图像本身?
原标题:Why do PDFs generated from HTML with images consume significantly more storage than the images themselves?

为什么有图像的超文本产生的PDF消耗量大大高于图像本身,我如何避免这种情况?

E.g.

This image have ~1.6MB https://cdn.wallpapersafari.com/21/63/kGOzq7.jpg

<!DOCTYPE html>
<html lang="de">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Example</title>
        <style>
            body {
                position: relative;
                width: 148mm;
                height: 210mm;
                margin: 0;
                display: flex;
                flex-direction: column;
                font-family: "Times New Roman", Times, serif;
                border: 1px dashed black;
                user-select: none;
            }
            div.textarea {
                position: relative;
                flex-grow: 1;
                margin: 12mm 15mm 20mm 15mm;
            }
            img {
                width: 100%;
            }
            @media print {
                @page {
                    size: A5;
                    margin: 0;
                }
            }
        </style>
    </head>
    <body>
        <div class="textarea odd">
            <img src="https://cdn.wallpapersafari.com/21/63/kGOzq7.jpg" />
        </div>
    </body>
</html>

请查看这一html档案。 其中包括我以前所展示的形象。 如果我用chrom(ium)在一份pdf档案中印刷这一html,则pdf文档为5,3MB,但图像只有1.6MB。

为什么要高得多?

问题回答




相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签