Search This Blog
Showing posts with label pdf. Show all posts
Showing posts with label pdf. Show all posts
Tuesday, 10 June 2014
Interview Questions
Labels:
A,
Answer,
free download,
hibernate,
interview,
Interview Questions,
j2ee,
j2ee interview Questions and answer,
j2me,
j2se,
JBoss,
jdbc,
jsf,
JSP,
pdf,
Q,
RMI,
Servlet,
Servlet Interview Questions and Answers,
Struts
Java Threads interview questions and answers
Labels:
A,
Answer,
free download,
interview,
java thread,
multithreading,
pdf,
Q,
Question,
thread,
threading,
threads
Core Java Interview Questions and Answers
Core Java Interview Questions and Answers
Core java Interview Questions and Answers
Thursday, 9 January 2014
how to write data into PDF using Servlet
Example to write data into PDF using servlet
Let's see the simple example of writing data into PDF using servlet. In this example, we have mentioned the content type application/pdf that must be specified to display data in the PDF format.
ServletPDF.java- package com.javatpoint;
- import java.io.*;
- import java.util.*;
- import javax.servlet.*;
- import javax.servlet.http.*;
- import com.darwinsys.spdf.PDF;
- import com.darwinsys.spdf.Page;
- import com.darwinsys.spdf.Text;
- import com.darwinsys.spdf.MoveTo;
- public class ServletPDF extends HttpServlet {
- public void doGet(HttpServletRequest request,
- HttpServletResponse response) throws IOException {
- PrintWriter out = response.getWriter();
- response.setContentType("application/pdf");
- response.setHeader("Content-disposition","inline; filename='rajvishwakarma15@blogspot.pdf'");
- PDF p = new PDF(out);
- Page p1 = new Page(p);
- p1.add(new MoveTo(p, 200, 700));
- p1.add(new Text(p, "rajvishwakarma15@blogspot.com"));
- p1.add(new Text(p, "by Raj Vishwakarma"));
- p.add(p1);
- p.setAuthor("Ian ");
- p.writePDF();
- }
- }
download this example (developed using Myeclipse IDE)
download this example (developed using Eclipse IDE)
download this example (developed using Netbeans IDE)
download this example (developed using Eclipse IDE)
download this example (developed using Netbeans IDE)
Ref. javatpoint.com
Subscribe to:
Posts (Atom)