diff options
author | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-07-08 18:08:26 +0200 |
---|---|---|
committer | Andreas Fitzek <andreas.fitzek@iaik.tugraz.at> | 2014-07-08 18:08:26 +0200 |
commit | ee90b4f0118d0ad76edf6995267ac900d4ecf2b6 (patch) | |
tree | 738e50769919ec0fb6883c8c903afe32fbed7345 /pdf-as-lib | |
parent | 023cff0dc812b943b636cdb9d26e251e233fbcbb (diff) | |
download | pdf-as-4-ee90b4f0118d0ad76edf6995267ac900d4ecf2b6.tar.gz pdf-as-4-ee90b4f0118d0ad76edf6995267ac900d4ecf2b6.tar.bz2 pdf-as-4-ee90b4f0118d0ad76edf6995267ac900d4ecf2b6.zip |
Keep Font Dictionary in Resources original during positioning
Diffstat (limited to 'pdf-as-lib')
-rw-r--r-- | pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java index 4ce8daa9..6911c698 100644 --- a/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java +++ b/pdf-as-lib/src/main/java/at/knowcenter/wag/egov/egiz/pdf/PDFPage.java @@ -56,12 +56,14 @@ import java.util.Map; import org.apache.commons.lang3.math.NumberUtils; import org.apache.pdfbox.cos.COSBase; +import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSStream; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.PDResources; import org.apache.pdfbox.pdmodel.common.PDRectangle; import org.apache.pdfbox.pdmodel.common.PDStream; +import org.apache.pdfbox.pdmodel.font.PDFont; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObject; import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectForm; import org.apache.pdfbox.pdmodel.interactive.annotation.PDAnnotation; @@ -359,6 +361,25 @@ public class PDFPage extends PDFTextStripper { maxPathRelatedYPositionFromTop); } + @Override + public Map<String, PDFont> getFonts() { + + COSBase fontObj = null; + + if(getCurrentPage().getResources() != null && + getCurrentPage().getResources().getCOSDictionary() != null && + getCurrentPage().getResources().getCOSDictionary().getDictionaryObject(COSName.FONT) != null) { + fontObj = getCurrentPage().getResources().getCOSDictionary().getDictionaryObject(COSName.FONT); + } + Map<String, PDFont> fontMap = getCurrentPage().findResources().getFonts(); + + if(fontObj != null) { + getCurrentPage().getResources().getCOSDictionary().setItem(COSName.FONT, fontObj); + } + + return fontMap; + } + public class MyInvoke extends OperatorProcessor { private PDFPage mypage; |