Duplizieren eines anklickbaren Symbols im PDF bei Verwendung von PdfFileAttachmentAnnotation von Itext7CSS

CSS verstehen
Anonymous
 Duplizieren eines anklickbaren Symbols im PDF bei Verwendung von PdfFileAttachmentAnnotation von Itext7

Post by Anonymous »

Image

Dies ist eine Methode, bei der ein neues Symbol mithilfe von Rechteckkoordinaten in das PDF eingefügt wird. Es werden jedoch zwei Symbole erstellt, eines zum Herunterladen des Dokuments und das andere nur mit einem Bild.

Code: Select all

private boolean attachExcelSheet1(Order order, PdfDocument pdfDocument, PdfPage pdfPage, ByteArrayOutputStream excelFile, String detailLink) {
int y = order.getMajorVersion().getValue() > 0 ? 283 : 330;
Rectangle rect = new Rectangle(574, 204, 5, 5);
byte[] embeddedFileContentBytes = excelFile.toByteArray();
String fileName = detailLink + order.getOrderRevision() + ".xlsx";
PdfFileSpec fs = PdfFileSpec.createEmbeddedFileSpec(pdfDocument, embeddedFileContentBytes, null, fileName, null, null);
PdfAnnotation attachment = new PdfFileAttachmentAnnotation(rect, fs)
.setContents(String.format("%s %s", detailLink, order.getOrderRevision()));
pdfPage.addAnnotation(attachment);
return true;
}
Image

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post