I’m using solr to search through pdfs, and I need to highlight the matching terms directly on the pdf. The issue I’m running into is I need to either use open parameters or an XML document with the highlighting details, but I don’t see how to pass either of these to vaadin.
For reference, details on the xml doc and open parameters are here: https://svn.apache.org/repos/asf/pdfbox/site/userguide/highlighting.pdf?p=900000
This is the code I have to display the pdf:
private void displayPdf(byte[] toDisplay, String fileName) {
StreamResource r = new StreamResource(new StreamSource() {
@Override
public InputStream getStream() {
return new ByteArrayInputStream(toDisplay);
}
}, fileName);
r.setCacheTime(0);
r.setMIMEType("application/pdf");
BrowserFrame pdfFrameContent = new BrowserFrame(null, r);
secondSection.replaceComponent(currentComponent, pdfFrameContent);
pdfFrameContent.setWidth("865px");
pdfFrameContent.setHeight("525px");
currentComponent = pdfFrameContent;
}