
i have a pdf, which has to be displayed in a jsp page along with some html tags, the pdf which is to be displayed shold be readonly and wont allow the uer to save too.......

Hi Friend,
Try the following code:
<%@page import="java.io.*"%>
<%@page import="java.util.*"%>
<%@page import="com.lowagie.text.*"%>
<%@page import="com.lowagie.text.pdf.*"%>
<%
try {
Document document = new Document();
document.open();
PdfReader reader = new PdfReader("C:/data.pdf");
PdfDictionary dictionary = reader.getPageN(1);
PRIndirectReference reference = (PRIndirectReference) dictionary.get(PdfName.CONTENTS);
PRStream stream = (PRStream) PdfReader.getPdfObject(reference);
byte[] bytes = PdfReader.getStreamBytes(stream);
PRTokeniser tokenizer = new PRTokeniser(bytes);
StringBuffer buffer = new StringBuffer();
while (tokenizer.nextToken()) {
if (tokenizer.getTokenType() == PRTokeniser.TK_STRING) {
buffer.append(tokenizer.getStringValue()+" ");
}
}
String test = buffer.toString();
out.println(test);
} catch (Exception e) {
}
%>
For the above code, you need itext api.
Thanks

Thanks a lot!!!!!!!!!!
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.