I was able to disable hyperlink using
PDActionHide actionshow = new PDActionHide();
actionshow.setH(true);
However I want to remove blue colour hyperlink but keep the text. How do I do this using Apache PDFBox?
Do this (works only if the line is part of the annotation and not of the content stream):
PDAnnotationLink txtLink = ...
txtLink.setBorderStyle(null);
txtLink.setBorder(new COSArray());
this removes the border style and sets an empty color.
Related
My program links a position in a PDF-file to another page in the same file. So you can click on a defined position in the file an you'll be linked to another page.
I use a PDRectangle to define the position. Unfortunately the rectangle is visible in the document. I want to create the link without a visible border.
My code:
PDActionGoTo action = new PDActionGoTo();
action.setDestination(destination);
PDAnnotationLink annotationLink = new PDAnnotationLink();
annotationLink.setAction(action);
PDRectangle position = new PDRectangle();
position.setLowerLeftX(bookmarkLinkPositionEntry.getLowerLeftX());
position.setLowerLeftY(bookmarkLinkPositionEntry.getLowerLeftY());
position.setUpperRightX(bookmarkLinkPositionEntry.getUpperRightX());
position.setUpperRightY(bookmarkLinkPositionEntry.getUpperRightY());
annotationLink.setRectangle(position);
destinationPDF.getPage(0).getAnnotations().add(annotationLink);
I tried to use annotationLink.setHidden(true); and annotationLink.setNoView(true);. The documentation just says "Set the hidden flag." and "Set the noView flag." and I don't know what actually happened there.
How can I change the visibility of my rectangle or remove the border completely?
You'll need to set the border style:
PDBorderStyleDictionary borderULine = new PDBorderStyleDictionary();
borderULine.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
borderULine.setWidth(0);
annotationLink.setBorderStyle(borderULine);
More on this topic in the AddAnnotations.java example in the source code download.
I am successfully drawing a line in an svg using java. The line tag or name is shown using a GWT label in a div containing the svg. Is there a way to display tag using svg itself? (without using label and div's)
OMSVGTextElement element;
private OMSVGSVGElement svgElement;
svgElement = doc.createSVGSVGElement();
element=doc.createSVGTextElement();
element.getElement().setInnerText("link label"); //the label
svgElement.appendChild(element);
This should do.
I have got two doubts. I have created a word document with a table in Apache POI.
How to underline text?
XWPFRun rh = para.createRun();
rh.setText("Added to Watchlist");
rh.setBold(true);
I have created a text content and I have bolded it. How to underline it? I found a function rh.setUnderline
What is the parameter for rh.setUnderline()
how to hide table border in Apache POI?
XWPFTable table = doc.createTable(5, 5);
I want to hide the border of this table? How do I it?
You could try:
table.getCTTbl().getTblPr().unsetTblBorders();
For the first question, rh.setUnderline(UnderlinePatterns.SINGLE) or any other parameters depending on the underline style will work.
This is answer for how to set underline in text. You can try this:
XWPFParagraph subparacenter = document.createParagraph();
subparacenter.setAlignment(ParagraphAlignment.LEFT);
**XWPFRun subcenterRun = subparacenter.createRun();**
subcenterRun.setUnderline(UnderlinePatterns.SINGLE);
subcenterRun.setFontSize(11);
How can I draw a horizontal line in java gwt, something similar to the '< hr >' tag in HTML? I tried it by using
com.google.gwt.user.client.Element bottomLine = DOM.createDiv();
but that somehow doesn't work in IE...
You can use the HTML widget to add whatever html you want inside your page
HTML html = new HTML("<hr style=\"width:100%;\" />")
rootPanel.add(html); // or add it inside another widget
Or you can use css on Panel and define the border-bottom property (if you have a panel that spans the entire page).
Document.get().createHRElement()?
How to change single element of the widget style in GWT. I would like to create new version of TextBox style, so that only the border color changed to red, for example.How to get to the style responsible for the TextBox?
I tried to create new style
.gwt-TextBox.invalid {
border-color: red;
}
but it does not work.
Make sure you add class invalid to your TextBox:
textBox.addStyleName("invalid");
Use CssResource to associate your CSS file with GWT: http://code.google.com/webtoolkit/doc/latest/DevGuideUiCss.html#cssfiles