remove ef.setFile(...) entry, this solve the pdf a problems
This commit is contained in:
@@ -20,9 +20,8 @@ package pdfbox;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.GregorianCalendar;
|
import java.util.GregorianCalendar;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.xml.transform.TransformerException;
|
import javax.xml.transform.TransformerException;
|
||||||
|
|
||||||
@@ -33,7 +32,6 @@ import org.apache.jempbox.xmp.XMPSchemaPDF;
|
|||||||
import org.apache.jempbox.xmp.pdfa.XMPSchemaPDFAId;
|
import org.apache.jempbox.xmp.pdfa.XMPSchemaPDFAId;
|
||||||
import org.apache.pdfbox.cos.COSArray;
|
import org.apache.pdfbox.cos.COSArray;
|
||||||
import org.apache.pdfbox.cos.COSDictionary;
|
import org.apache.pdfbox.cos.COSDictionary;
|
||||||
import org.apache.pdfbox.cos.COSName;
|
|
||||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
|
import org.apache.pdfbox.pdmodel.PDDocumentCatalog;
|
||||||
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
|
import org.apache.pdfbox.pdmodel.PDDocumentInformation;
|
||||||
@@ -87,7 +85,7 @@ public class PDFA3FileAttachment
|
|||||||
// set some of the attributes of the embedded file
|
// set some of the attributes of the embedded file
|
||||||
|
|
||||||
ef.setSubtype("text/plain");
|
ef.setSubtype("text/plain");
|
||||||
ef.setFile(fs);
|
// ef.setFile(fs);
|
||||||
// ef.getStream().setItem(COSName.UF, fs);
|
// ef.getStream().setItem(COSName.UF, fs);
|
||||||
|
|
||||||
ef.setModDate(GregorianCalendar.getInstance());
|
ef.setModDate(GregorianCalendar.getInstance());
|
||||||
@@ -103,9 +101,7 @@ public class PDFA3FileAttachment
|
|||||||
fs.setEmbeddedFile(ef);
|
fs.setEmbeddedFile(ef);
|
||||||
|
|
||||||
// now add the entry to the embedded file tree and set in the document.
|
// now add the entry to the embedded file tree and set in the document.
|
||||||
Map efMap = new HashMap();
|
efTree.setNames(Collections.singletonMap("My first attachment", fs));
|
||||||
efMap.put("My first attachment", fs);
|
|
||||||
efTree.setNames(efMap);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Validating file "RE-20131206_22.pdf" for conformance level pdfa-3a The
|
* Validating file "RE-20131206_22.pdf" for conformance level pdfa-3a The
|
||||||
@@ -161,7 +157,7 @@ public class PDFA3FileAttachment
|
|||||||
|
|
||||||
doc.addPage(page);
|
doc.addPage(page);
|
||||||
|
|
||||||
InputStream fontStream = PDFA3FileAttachment.class.getResourceAsStream("/resources/Ubuntu-R.ttf");
|
InputStream fontStream = PDFA3FileAttachment.class.getResourceAsStream("/Ubuntu-R.ttf");
|
||||||
PDFont font = PDTrueTypeFont.loadTTF(doc, fontStream);
|
PDFont font = PDTrueTypeFont.loadTTF(doc, fontStream);
|
||||||
|
|
||||||
// create a page with the message where needed
|
// create a page with the message where needed
|
||||||
|
|||||||
Reference in New Issue
Block a user