귀하의 연구에서 정확합니다.
대부분의 경우 pdf 문서 전체에 속한 메타 데이터와 TIFF 이미지에 속한 메타 데이터를 구별하는 것이 중요하기 때문입니다. 첫 번째는 실제로 pdf 당 하나의 인스턴스로 제한됩니다. 두 번째는 PDF 메타 데이터에 독립적이지만 첨부 파일로 추가 할 수 있으며 PDF/A-3 표준에서 허용됩니다. 두 유형 모두 어떤 페이지와도 독립적이므로 이러한 의미에서 Boss의 요청은 PDF 형식에 대한 지식 부족을 형식으로 나타냅니다.
그러나 메타 데이터를 가리키는 각 Tiff에 링크 주석을 넣을 수도 있습니다. 선택 사항으로 두 번째 pdf 파일에 저장되어 데이터가 어떻게 든 페이지에 표시된다는 환상을 제공 할 수 있습니다.
이제 iText가이 문제를 해결할 도구를 제공하지 않는다는 사실에 정중히 동의해야합니다. Chapter 7 of the iText7 Jumpstart tutoria l은 파일 포함을 포함하여 PDF/A-X 생성을 처리합니다. PDF/A-3은 세 번째 예입니다.
링크 주석은 Pdf-spec (내장 된 Go-To 작업) 및 iText의 하위 수준 조작 방법에 대한 지식을 가지고 가능합니다. 지금 당장은 준비된 예가 없지만 나중에 추출 할 수 있는지 알아볼 것입니다.
편집 : 음, Foxit도 Adobe의 독자도 포함 된 이동 작업을 지원하지 않습니다. 그래도 관심이있는 경우, iText7을 사용하여 PDF/A-3 규격 문서를 작성하고 메타 데이터를 별도의 Pdf로 추가하는 데 사용 된 코드는 다음과 같습니다.
public static String INTENT = "src/test/resources/StackOverflow/EmbeddedLinking/sRGB_CS_profile.icm";
public static String IMG = "src/test/resources/StackOverflow/EmbeddedLinking/itis.jpg";
public static String META = "target/output/StackOverflow/EmbeddedLinking/metadata.pdf";
public static String DEST = "target/output/StackOverFlow/EmbeddedLinking/embeddedMetaData.pdf";
public static void main(String[] args) throws IOException, java.io.IOException {
File file = new File(DEST);
file.getParentFile().mkdirs();
new EmbeddedLinking().createPdf(META);
new EmbeddedLinking().createPdfWithEmbeddedFile(DEST,META,IMG,INTENT);
}
public void createPdf(String dest) throws IOException, FileNotFoundException{
PdfWriter writer = new PdfWriter(dest);
PdfDocument pdfDoc = new PdfDocument(writer);
Document doc = new Document(pdfDoc);
//Put some data here
doc.add(new Paragraph("This is the metadata"));
doc.add(new Paragraph("The Cake is Lie"));
doc.add(new Paragraph("42"));
doc.add(new Paragraph("The Spice must flow"));
doc.close();
}
public void createPdfWithEmbeddedFile(String dest, String embeddedPath, String imgPath, String intent) throws java.io.IOException {
PdfWriter writer = new PdfWriter(dest);
PdfOutputIntent outputIntent = new PdfOutputIntent("Custom", "","http://www.color.org", "sRGB IEC61966-2.1", new FileInputStream(intent));
PdfADocument pdfADoc = new PdfADocument(writer, PdfAConformanceLevel.PDF_A_3A,outputIntent);
//Setting some required parameters
pdfADoc.setTagged();
pdfADoc.getCatalog().setLang(new PdfString("en-US"));
pdfADoc.getCatalog().setViewerPreferences(
new PdfViewerPreferences().setDisplayDocTitle(true));
PdfDocumentInfo info = pdfADoc.getDocumentInfo();
info.setTitle("iText7 PDF/A-3 Embedded Go-To example");
//Add attachment
PdfDictionary parameters = new PdfDictionary();
parameters.put(PdfName.ModDate, new PdfDate().getPdfObject());
PdfFileSpec fileSpec = PdfFileSpec.createEmbeddedFileSpec(
pdfADoc, Files.readAllBytes(Paths.get(embeddedPath)), "metadata.pdf",
"metadata.pdf", new PdfName("application/pdf"), parameters,
PdfName.Data, false);
fileSpec.put(new PdfName("AFRelationship"), new PdfName("Data"));
pdfADoc.addFileAttachment("metadata.pdf", fileSpec);
PdfArray array = new PdfArray();
array.add(fileSpec.getPdfObject().getIndirectReference());
pdfADoc.getCatalog().put(new PdfName("AF"), array);
//Add Image
int imagePage = 1; //We know the image will end up on the first page since it's the only thing we add to the document
Document doc = new Document(pdfADoc, PageSize.A4);
Image img = new Image(ImageDataFactory.create(imgPath));
doc.add(img);
//Add link annotation to embedded file
float pageHeight = PageSize.A4.getHeight();
float imageWidth = img.getImageWidth();
float imageHeight = img.getImageHeight();
float x = doc.getLeftMargin();
float y = pageHeight - doc.getTopMargin() - imageHeight;
Rectangle linkAnnotationPosition = new Rectangle(x,y,imageWidth,imageHeight);
PdfLinkAnnotation linkAnnotation = new PdfLinkAnnotation(linkAnnotationPosition);
//Setup the Embedded GoTO action
PdfExplicitDestination explicitDestination = PdfExplicitDestination.createFit(imagePage);//Destination in the target file
PdfTargetDictionary targetDictionary = PdfTargetDictionary.createChildTarget("metadata.pdf"); //Target embedded file
PdfAction action = PdfAction.createGoToE(fileSpec,explicitDestination,true,targetDictionary);
linkAnnotation.setAction(action);
//PDF/A requires the presence of the F -bit flag array in every dictionary. The print flag needs to be 1, and some other flags 0.
//See the spec for details and options, but the bit pattern represented by the integer 4 suffices for conformance to PDF/A-3
int fBitArray = 4;
linkAnnotation.put(PdfName.F,new PdfNumber(fBitArray));
//Add annotation to page
pdfADoc.getPage(imagePage).addAnnotation(linkAnnotation);
//Close document
doc.close();
}
* "PDF에 하나 개의 XMP 파일이 있어야처럼 PDF/A 메타 데이터 구조에 대한 내 연구에 따르면, 그것은 보인다"* - 종종 문서와와 관련된 하나 하나 개의 메타 데이터 스트림이있다 전체. Samuel의 답변에 대한 더 많은 의견이 있습니다. – mkl