Thanks I would like to share a part of code that perform computing for
genrating pdf:
final String RESULT = "TestReport.pdf";
Document document = new Document();
// step 2
try {
PdfWriter.getInstance(document, new FileOutputStream(RESULT));
}
catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// step 3
document.open();
// step 4
PdfPTable table1 = null;
try {
table1 = createTable1();
}
catch (DocumentException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
try {
document.add(table1);
} catch (DocumentException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// step 5
document.close();
}
public PdfPTable createTable1() throws DocumentException {
PdfPTable table1 = new PdfPTable(8);
table1.setWidthPercentage(100f);
table1.setWidths(new int[]{1, 1, 1, 1, 1, 1, 1, 1});
PdfPCell cell;
cell = new PdfPCell(new Phrase("System Computed Observations:"));
cell.setColspan(8);
cell.setRowspan(2);
table1.addCell(cell);
table1.addCell("Approach ");
table1.addCell("Start");
table1.addCell("End");
//some codes
return table1;
}
for the url connection
----------------------
private URL url;
private URLConnection urlConn;
url = new URL(getCodeBase().toString());
urlConn = url.openConnection();
urlConn.setDoInput(true);
urlConn.setUseCaches(false);
I have also converted it into signed applet and can easily generate pdf in
local machine but when i am running on server i am unable to generate pdf
file.
Thanks,
Ritesh Sharma
IIT bombay
> Most browsers don't have PDFviewer internally. The PDF is donwloaded
> then. Usually a PDF Viewer has a component which allows you to see the
> pdf inside the browser upon download.
>
> Without you code we cannot tell you what is going wrong. Please also
> bear in mind applets are restricted in what they can do. Perhaps there
> is an exception in your java applets console log.
>
> Anyway if your PDF code is fine because a PDF is being generated, then
> you probably should read up a bit more applets and their usage.
> (Dependable on what you want you could also take a look at Java Web Start
> )
>
> On 26/12/2011 11:46, Ritesh Sharma wrote:
>> Hi,
>>
>> I would like to know whether is it possible to open pdf in a web
>> browser.I
>> am using itext and java applet to create pdf.I have also signed my java
>> applet in order to generate pdf file.It is generating pdf file but when
>> I
>> am putting it on my webserver where other php webpages are stored,pdf is
>> not generated.I am invoking my applet using php webpage.If there is
>> someone who has done it before,do let me know the steps.
>>
>> thanks,
>> Ritesh
>>
>>
>> ------------------------------------------------------------------------------
>> Write once. Port to many.
>> Get the SDK and tools to simplify cross-platform app development. Create
>> new or port existing apps to sell to consumers worldwide. Explore the
>> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
>> http://p.sf.net/sfu/intel-appdev
>> _______________________________________________
>> iText-questions mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/itext-questions
>>
>> iText(R) is a registered trademark of 1T3XT BVBA.
>> Many questions posted to this list can (and will) be answered with a
>> reference to the iText book: http://www.itextpdf.com/book/
>> Please check the keywords list before you ask for examples:
>> http://itextpdf.com/themes/keywords.php
> Kind Regards
>
> Balder
> --
> twitter <http://twitter.com/redlabbe>
> redlab-log <http://www.redlab.be/blog/>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev_______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> iText(R) is a registered trademark of 1T3XT BVBA.
> Many questions posted to this list can (and will) be answered with a
> reference to the iText book: http://www.itextpdf.com/book/
> Please check the keywords list before you ask for examples:
> http://itextpdf.com/themes/keywords.php
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples:
http://itextpdf.com/themes/keywords.php