[Building Sakai] Body Content

Iuliana iulianas at gmail.com
Tue Sep 22 12:41:47 PDT 2009


Hi,

I'm trying to get content from CONTENT_RESOURCE_BODY_BINARY table.
Then, When I get the content and convert to PDF, I get the error using:

String id2 = contentBlob.toString();

    Blob blob = new Blob(id2.getBytes());

    InputStream blobStream = blob.inputStream();
    ...
    if(ext.equals(".pdf")){
        getPDFContent(blobStream);
    ...

public String getPDFContent(InputStream contentStream) {

        PDFParser parser = null;
        try
        {
            parser = new PDFParser(contentStream);
            parser.parse();
            PDDocument pddoc = parser.getPDDocument();
            COSDocument cos = parser.getDocument();

            PDFTextStripper stripper = new PDFTextStripper();
            stripper.setLineSeparator("\n");

            CharArrayWriter cw = new CharArrayWriter();

            String text = stripper.getText(cos);
            System.out.println(text);


            pddoc.close();

            return text;

        }
        catch (Exception ex)
        {
            try {
                PDDocument pddoc = parser.getPDDocument();
                pddoc.close();
            } catch ( Exception e ) {

            }
            throw new RuntimeException("Failed to get content for indexing:
cause: "+ex.getMessage(), ex);
        }
Error: ZipException: Incorrect header check.

Please, some one, help-me.

-- 
Iuliana Souza
Graduada em Análise de Sistemas
(16) 9963-9155
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20090922/f40adf99/attachment.html 


More information about the sakai-dev mailing list