Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to execute a function at a specified time set dynamically by user in java
    primarykey
    data
    text
    <p>I have a function in java which contains the code to generate the pdf file and save into the system local disk.Now as per my requirement i have to make a jsp page which contains a form from where user can dynamically set the date and time on which he needs pdf to be generated.Now pdf should be generated as per the user input given and user input is dynamic in nature it can be changed..</p> <p>For example ..</p> <p>Suppose user has set pdf to be created on 15 of every month at 10:00 am..Then this time it should generate the pdf on 15 at 10:00a am..</p> <p>Now if his requirement change he can set it to 10 of every month at 10:00 am ..and so on..</p> <p>I am not able to get the way to proceed..</p> <p>Here is my pdf generation code in POJO file..</p> <pre><code>OutputStream file = new FileOutputStream(new File("D://timer.pdf")); Document document = new Document(); PdfWriter.getInstance(document, file); //Inserting Table in PDF PdfPTable table = new PdfPTable(3); PdfPCell cell = new PdfPCell(new Paragraph("Java4s.com")); cell.setColspan(3); cell.setHorizontalAlignment(Element.ALIGN_CENTER); cell.setPadding(10.0f); cell.setBackgroundColor(new BaseColor(140, 221, 8)); table.addCell(cell); table.addCell("Name"); table.addCell("Address"); table.addCell("Country"); table.addCell("Java4s"); table.addCell("NC"); table.addCell("United States"); table.setSpacingBefore(30.0f); // Space Before table starts, like margin-top in CSS table.setSpacingAfter(30.0f); // Space After table starts, like margin-Bottom in CSS //Inserting List in PDF List list = new List(true, 30); list.add(new ListItem("Java4s")); list.add(new ListItem("Php4s")); list.add(new ListItem("Some Thing...")); //Text formating in PDF Chunk chunk = new Chunk("Welecome To Java4s Programming Blog..."); chunk.setUnderline(+1f, -2f);//1st co-ordinate is for line width,2nd is space between Chunk chunk1 = new Chunk("Php4s.com"); chunk1.setUnderline(+4f, -8f); chunk1.setBackground(new BaseColor(17, 46, 193)); //Now Insert Every Thing Into PDF Document document.open();//PDF document opened........ document.add(Chunk.NEWLINE); //Something like in HTML :-) document.add(new Paragraph("Dear Java4s.com")); document.add(new Paragraph("Document Generated On - " + new Date().toString())); document.add(table); document.add(chunk); document.add(chunk1); document.add(Chunk.NEWLINE); //Something like in HTML :-) document.newPage(); //Opened new page document.add(list); //In the new page we are going to add list document.close(); file.close(); System.out.println("Pdf created successfully.."); </code></pre> <p>Thanks in advance..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload