Announcement Announcement Module
No announcement yet.
AbstractPdfView errors Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • AbstractPdfView errors

    I'm putting together a Spring MVC project and want to use a PDF document view. I am using SpringSource Tool Suite Version: 2.3.2.RELEASE Build Id: 201003230009

    I could not add a dependency for itext via the POM editor so
    I manually added the file com.lowagie.itext-5.0.1.jar using mvn install:..... to the local maven repository. Then I added the following dependency to the project POM file.


    When I go to create a controller class. I get errors that com.lowagie.text.Document | PDFWriter can not be resolved.
    However, I can resolve using suggested fix - import com.itextpdf.text.Document;

    Anybody come across this kind of thing before? Any advice? Thanks much.

    Class code is below:

    package edu.uvm.pdfrenderer;
    import java.util.Map;

    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.springframework.web.servlet.view.document.Abst ractPdfView;

    import com.itextpdf.*;
    import com.itextpdf.text.Document;
    import com.itextpdf.text.Paragraph;
    import com.itextpdf.text.pdf.PdfWriter;
    import com.sun.xml.internal.bind.v2.schemagen.xmlschema.L ist;

    public class pdfController extends AbstractPdfView {
    protected void buildPdfDocument(
    Map model,
    Document doc,
    PdfWriter writer,
    HttpServletRequest req,
    HttpServletResponse resp)
    throws Exception {
    List words = (List) model.get("wordList");

    for (int i=0; i<words.size(); i++)
    doc.add( new Paragraph((String) words.get(i)));

  • #2
    Yes, I'm having this problem as well. Spring needs to update the AbstractPdfView class to point to the renamed itextpdf package names.

    For now, I think the solution is to download an old version of iText (2.1.7) that has the com.lowagie.* package names.