-
Notifications
You must be signed in to change notification settings - Fork 369
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #640 from danfickle/file_embeds_for_508
- Loading branch information
Showing
8 changed files
with
334 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
openhtmltopdf-examples/src/main/resources/visualtest/html/issue-508-file-embed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<html> | ||
<head> | ||
<style> | ||
@page { | ||
size: 200px 200px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
Embedded <a href="stylesheets/basic.css" download="basic.css" data-content-type="text/plain">text <br/> document</a>. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
openhtmltopdf-pdfa-testing/src/test/resources/html/file-embed.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<html lang="EN-US"> | ||
<head> | ||
<title>File embed testcase</title> | ||
<meta name="subject" content="PDF/A3 file embed"/> | ||
<meta name="author" content="openhtmltopdf.com team"/> | ||
<meta name="description" content="An example for file embed"/> | ||
|
||
<bookmarks> | ||
<bookmark name="File embed" href="#file"/> | ||
</bookmarks> | ||
|
||
<style> | ||
body { | ||
margin: 0; | ||
font-family: 'TestFont'; /* Font provided with builder. */ | ||
font-size: 15px; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<h1 id="file">File embed example</h1> | ||
|
||
<p> | ||
<a href="file-embed.html" | ||
download="source.html" | ||
data-content-type="text/html" | ||
title="File embedded" | ||
relationship="Source"> | ||
|
||
File embed | ||
|
||
</a> | ||
</p> | ||
|
||
</body> | ||
</html> |
64 changes: 64 additions & 0 deletions
64
openhtmltopdf-pdfbox/src/main/java/com/openhtmltopdf/pdfboxout/AnnotationContainer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package com.openhtmltopdf.pdfboxout; | ||
|
||
import org.apache.pdfbox.pdmodel.common.PDRectangle; | ||
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation; | ||
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationFileAttachment; | ||
import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotationLink; | ||
import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary; | ||
|
||
public abstract class AnnotationContainer { | ||
public void setRectangle(PDRectangle rectangle) { | ||
getPdAnnotation().setRectangle(rectangle); | ||
} | ||
|
||
public void setPrinted(boolean printed) { | ||
getPdAnnotation().setPrinted(printed); | ||
} | ||
|
||
public void setQuadPoints(float[] quadPoints) {}; | ||
|
||
public abstract void setBorderStyle(PDBorderStyleDictionary styleDict); | ||
|
||
public abstract PDAnnotation getPdAnnotation(); | ||
|
||
public static class PDAnnotationFileAttachmentContainer extends AnnotationContainer { | ||
private final PDAnnotationFileAttachment pdAnnotationFileAttachment; | ||
|
||
public PDAnnotationFileAttachmentContainer(PDAnnotationFileAttachment pdAnnotationFileAttachment) { | ||
this.pdAnnotationFileAttachment = pdAnnotationFileAttachment; | ||
} | ||
|
||
@Override | ||
public PDAnnotation getPdAnnotation() { | ||
return pdAnnotationFileAttachment; | ||
} | ||
|
||
@Override | ||
public void setBorderStyle(PDBorderStyleDictionary styleDict) { | ||
pdAnnotationFileAttachment.setBorderStyle(styleDict); | ||
} | ||
} | ||
|
||
public static class PDAnnotationLinkContainer extends AnnotationContainer { | ||
private final PDAnnotationLink pdAnnotationLink; | ||
|
||
public PDAnnotationLinkContainer(PDAnnotationLink pdAnnotationLink) { | ||
this.pdAnnotationLink = pdAnnotationLink; | ||
} | ||
|
||
@Override | ||
public PDAnnotation getPdAnnotation() { | ||
return pdAnnotationLink; | ||
} | ||
|
||
@Override | ||
public void setQuadPoints(float[] quadPoints) { | ||
pdAnnotationLink.setQuadPoints(quadPoints); | ||
} | ||
|
||
@Override | ||
public void setBorderStyle(PDBorderStyleDictionary styleDict) { | ||
pdAnnotationLink.setBorderStyle(styleDict); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.