Image missing from SVG used as background object in HTML

10 views
Skip to first unread message

Ryan

unread,
Jan 17, 2017, 8:49:47 PM1/17/17
to PDFTron PDFNet SDK
Question:

When I use the SVG output from PDFNet as the CSS background for my HTML page, the images are not appearing.

The command I use to generate the SVG is

pdf2svg --embedfonts -o output input.pdf

And the HTML is

<!DOCTYPE html>
<title>
  Test of rendered SVG.
</title>
<head>
 
<style>
   
#pageBg {
     background
: url('output.svg');
     background
-repeat: no-repeat;
     overflow
: hidden;
     position
: absolute;  
     width
: 1816px;
     height
: 826.5px;
   
}
   body
{
     overflow
: hidden;
   
}
 
</style>
</head>
<div style="position:absolute" id="pageBg">
</div>
</body>
</html>

Answer:

It appears there is a limitation on CSS background url that prevents accessing external elements. 

You need to embed both the fonts and images.

pdf2svg --embedfonts --embedimages -o output input.pdf




Reply all
Reply to author
Forward
0 new messages