Im writing an Eclipse plugin which posses a function of generating pdf files. but im in a really weird situation. when i add this functionality (generation of pdf file) im not able to run the plugin and it doesnt through any exeption. i already tried two pdf libraries iText and pdfBox but its the same problem.
here is the function for generating the pdf file using iText library:
public void createPdf()
{
Document document = new Document();
PdfWriter writer;
try {
writer = PdfWriter.getInstance(document, new FileOutputStream("C:\\aaa\\aaa.pdf"));
document.open();
document.add(new Paragraph("cccccc"));
document.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}
}
and pretty much the same function using pdfBox library:
public static void pd()
{
try {
doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(page);
doc.save("C:\\film\\eldi.pdf");
} catch (IOException e) {
e.printStackTrace();
} catch (COSVisitorException e) {
e.printStackTrace();
}
finally
{
if(doc!=null)
try {
doc.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Can anyone help with this issue?
here is the function for generating the pdf file using iText library:
public void createPdf()
{
Document document = new Document();
PdfWriter writer;
try {
writer = PdfWriter.getInstance(document, new FileOutputStream("C:\\aaa\\aaa.pdf"));
document.open();
document.add(new Paragraph("cccccc"));
document.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (DocumentException e) {
e.printStackTrace();
}
}
and pretty much the same function using pdfBox library:
public static void pd()
{
try {
doc = new PDDocument();
PDPage page = new PDPage();
doc.addPage(page);
doc.save("C:\\film\\eldi.pdf");
} catch (IOException e) {
e.printStackTrace();
} catch (COSVisitorException e) {
e.printStackTrace();
}
finally
{
if(doc!=null)
try {
doc.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
Can anyone help with this issue?