This question already has answers here:
how to get field page in PDFBox API 2?
(1 answer)
how to know if a field is on a particular page?
(4 answers)
Closed 2 years ago.
If I have a 2 page pdf document with a signature field (signature1), how can I parse the document using pdfBox to find which page contains the signature field (either blank or signed).
OR how can I find the page No for signature1 in a multi page pdf document?
I can successfully add a signature field to page 2:
page = doc.getPage(1)
widget = signatureField.getWidgets().get(0)
widget.setAppearance(appearanceDictionary)
widget.setRectangle(rect)
//set it to page 2
widget.setPage(page)
from code example:
https://www.programcreek.com/java-api-examples/?api=org.apache.pdfbox.pdmodel.interactive.form.PDSignatureField
assuming you have the widget and it is not null:
PDPage signaturePage = widget.getPage();
int pageIndex = document.getPages().indexOf(signaturePage);
now you have the 0-based page number.
Related
This question already has an answer here:
Parameter Passing for statically included page in Struts 2
(1 answer)
Closed 5 years ago.
I am developing a small web application using struts, in my project there will be one jsp file named AdminOptions.jsp which gets the action class(LoginCheck.java) variable value using property value tag and it is displayed. I included the AdminOptions.jsp in another jsp file named DeleteEmployee.jsp using jsp include tag. While running the project, DeleteEmployee.jsp file not displaying the action class variable value which was displayed in AdminOptions.jsp it displays null value.
What is the reason?
What is the solution?
I did't found how you get the value.
Suppose the DeleteEmployee.jsp code as follows
<jsp:include page="......./AdminOptions.jsp" flush="true">
<jsp:param name="pageTitle" value="pageValue"/>
</jsp:include>
Note the flush = true is very important.
Then you can get the value in the DeleteEmployee.jsp by ${param.PageTitle}
you can use <s:push> tags to push the values to the included JSPs.
Reference:
http://struts.apache.org/2.1.8/docs/push.html
I am facing below issues also showing my PDF Result
Profile :Result of my Pdf
Name :Muthuramalaingam
Age :29
Details:
address:abcd, country, code.
1st page contain up to details: But the content isn't printed on 1st, 2nd page. Only printing 3rd, 4th page. Address details are printed on 5th page.
How to avoid skipping of the content and empty pages.
Details contain with html element, though I am using XMLParser to parse it as ElementList.
for (Element e : elements) { cell.addElement(e); } table.addCell(cell);
I am also using pageEventHandler which extended PdfPageEventHelper.
I have overriden with onStartPage() & onEndPage() both method itself. I am using columnText.showTextAligned method.
How to fix the content skipping issue. Looks not good if first page half of the page is empty.
This question already has answers here:
Selenium Select - Selecting dropdown option by part of the text
(8 answers)
Closed 6 years ago.
id of drop down = "rw_520631"
Value which I want to select from drop down is = "Automation RW (0/6)"
Now here "Automation RW" is static but "(0/6)" can change.
How can I select this using selenium webdriver in JAVA
This question was answered here - Selenium Select - Selecting dropdown option by part of the text
Below is the snippet of the answer:
List <WebElements> optionsInnerText= driver.findElements(By.tagName("option"));
for(WebElement text: optionsInnerText){
String textContent = text.getAttribute("textContent");
if(textContent.toLowerCase.contains(expectedText.toLowerCase))
select.selectByPartOfVisibleText(expectedText);
}
This question already has answers here:
How can I retain HTML form field values in JSP after submitting form to Servlet?
(2 answers)
Closed 6 years ago.
I am creating a dynamic web project in eclipse using servlets.
Once I submited the form with username and password fields in index.html page. When username or password is incorrect, the servlet class should display the index.html page again with the data entered in the input fields except password fields, but it is not showing any data in input fields.
You need to set the username and password in response and read it in jsp.
You need to make jsp to display values.
You can set Object using
eg request.setAttribute("cust",customer);
Read above object in jsp and display values in jsp.
This question already has answers here:
Reading a particular page from a PDF document using PDFBox
(6 answers)
Closed 9 years ago.
I know how to read text of an entire pdf file usinf PDFBox using PDFTextStripper.getText(PDDocument).
I also have a sample on how to get an object reference to a particular page using PDDocumentCatalog.getAllPages().get(i).
How do I get the text of just one page using PDFBox as I dont see any such method on PDPage class?
You can set parameters on the PDFTextStripper to read particular pages:
PDDocument doc; // document
int i; // page no.
PDFTextStripper reader = new PDFTextStripper();
reader.setStartPage(i);
reader.setEndPage(i);
String pageText = reader.getText(doc);
As far as I'm aware, PDPage is more used with representing a page onscreen, rather than extracting text. As such, I wouldn't recommend using this to extract text.