简体   繁体   中英

Is it possible to use PDF as HTML page background in CSS?

Is there a way to set a PDF as a background for an HTML file? It needs to be compliant to CSS v2.1. I'm looking to doing something like this in the html page:

body {
     background-image: url(FULLURL/myPDF.pdf);
}

The main purpose behind this is to to basically render an HTML as a PDF, overlaying an already existing PDF. (This I'm doing with PHP and resources like DOMPDF)

The reason it was to be CSS v2.1 compliant, is because the resource is set that way: https://github.com/dompdf/dompdf

https://www.w3.org/TR/CSS2/

Anyone have any ideas? I'm a bit stuck.

Setting it as a background, no, not possible. You may be able to get away with an ugly hack , but... I think you need to rethink what you're trying to accomplish and find an alternative solution.

PDF is a proprietary format and therefore does not play well with open web languages.

Background not an option as far as I know. But refer embed pdf to view a pdf on a page.

Referring to the original question: it is possible and it's actually pretty annoying! It leaves a whole white block on the webpage before the actual content; it can be viewed by right clicking View Background Image...

It looks like (incorrect URL):

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM