Skip to content

Commit

Permalink
#79 - Support and test for images & replaceds over two or more pages.
Browse files Browse the repository at this point in the history
For images that continue over more than one page, just mark the portion on the second and subsequent pages as an artifact. The spec (PDF 1.7) is not clear on what to do in this situation.
  • Loading branch information
danfickle committed Jan 21, 2019
1 parent ce6b7e9 commit d43af23
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,6 @@ public static void main(String... args) throws Exception {
run("layers-z-index");
run("text-over-two-pages");
run("image");
run("image-over-two-pages");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<html lang="EN-US">
<head>
<title>Image over two pages for PDF/UA</title>
<style>
@page {
size: 200px 200px;
margin: 0;
}
body {
margin: 0;
}
</style>
</head>
<body style="font-family: 'TestFont';">
<img style="width: 150px; height: 320px; display: block;" src="../../demos/images/flyingsaucer.png" alt="Sample Image Alt Text: Flyingsaucer"/>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -407,8 +407,14 @@ public Object startStructure(StructureType type, Box box) {
if (current != null) {
_cs.beginMarkedContent(COSName.getPDFName(StandardStructureTypes.Figure), current.dict);
return Boolean.TRUE;
} else {
// For images that continue over more than one page, just mark the portion on the second
// and subsequent pages as an artifact. The spec (PDF 1.7) is not clear on what to do in this
// situation.
COSDictionary bg = createBackgroundArtifact(type, box);
_cs.beginMarkedContent(COSName.ARTIFACT, bg);
return Boolean.TRUE;
}
return Boolean.FALSE;
}
default: {
return Boolean.FALSE;
Expand Down

0 comments on commit d43af23

Please sign in to comment.