/** * Creates a screen PdfAnnotation * @param writer * @param rect * @param clipTitle * @param fs * @param mimeType * @param playOnDisplay * @return a screen PdfAnnotation * @throws IOException */ public static PdfAnnotation createScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, boolean playOnDisplay) throws IOException { PdfAnnotation ann = writer.createAnnotation(rect, PdfName.SCREEN); ann.put (PdfName.F, new PdfNumber(FLAGS_PRINT)); ann.put(PdfName.TYPE, PdfName.ANNOT); ann.setPage(); PdfIndirectReference ref = ann.getIndirectReference(); PdfAction action = PdfAction.rendition(clipTitle,fs,mimeType, ref); PdfIndirectReference actionRef = writer.addToBody(action).getIndirectReference(); // for play on display add trigger event if (playOnDisplay) { PdfDictionary aa = new PdfDictionary(); aa.put(new PdfName("PV"), actionRef); ann.put(PdfName.AA, aa); } ann.put(PdfName.A, actionRef); return ann; }
/** * Creates a screen PdfAnnotation * @param writer * @param rect * @param clipTitle * @param fs * @param mimeType * @param playOnDisplay * @return a screen PdfAnnotation * @throws IOException */ public static PdfAnnotation createScreen(PdfWriter writer, Rectangle rect, String clipTitle, PdfFileSpecification fs, String mimeType, boolean playOnDisplay) throws IOException { PdfAnnotation ann = writer.createAnnotation(rect, PdfName.SCREEN); ann.put (PdfName.F, new PdfNumber(FLAGS_PRINT)); ann.put(PdfName.TYPE, PdfName.ANNOT); ann.setPage(); PdfIndirectReference ref = ann.getIndirectReference(); PdfAction action = PdfAction.rendition(clipTitle,fs,mimeType, ref); PdfIndirectReference actionRef = writer.addToBody(action).getIndirectReference(); // for play on display add trigger event if (playOnDisplay) { PdfDictionary aa = new PdfDictionary(); aa.put(new PdfName("PV"), actionRef); ann.put(PdfName.AA, aa); } ann.put(PdfName.A, actionRef); return ann; }