Commit 86913592 authored by Hib Eris's avatar Hib Eris Committed by Albert Astals Cid

Add CurlPDFDocBuilder

parent ec5c6117
......@@ -322,6 +322,7 @@ endif(ENABLE_ZLIB)
if(ENABLE_LIBCURL)
set(poppler_SRCS ${poppler_SRCS}
poppler/CurlCachedFile.cc
poppler/CurlPDFDocBuilder.cc
)
set(poppler_LIBS ${poppler_LIBS} ${CURL_LIBRARIES})
endif(ENABLE_LIBCURL)
......@@ -462,6 +463,7 @@ if(ENABLE_XPDF_HEADERS)
if(ENABLE_LIBCURL)
install(FILES
poppler/CurlCachedFile.h
poppler/CurlPDFDocBuilder.h
DESTINATION include/poppler)
endif(ENABLE_LIBCURL)
if(LIBOPENJPEG_FOUND)
......
//========================================================================
//
// CurlPDFDocBuilder.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
//
//========================================================================
#include <config.h>
#include "CurlPDFDocBuilder.h"
#include "CachedFile.h"
#include "CurlCachedFile.h"
//------------------------------------------------------------------------
// CurlPDFDocBuilder
//------------------------------------------------------------------------
PDFDoc *
CurlPDFDocBuilder::buildPDFDoc(GooString* uri,
GooString *ownerPassword, GooString *userPassword, void *guiDataA)
{
Object obj;
CachedFile *cachedFile = new CachedFile(
new CurlCachedFileLoader(), new GooString(uri));
obj.initNull();
BaseStream *str = new CachedFileStream(
cachedFile, 0, gFalse, cachedFile->getLength(), &obj);
return new PDFDoc(str, ownerPassword, userPassword, guiDataA);
}
GBool CurlPDFDocBuilder::supports(GooString* uri)
{
if (uri->cmpN("http://", 7) == 0 || uri->cmpN("https://", 8) == 0) {
return gTrue;
} else {
return gFalse;
}
};
//========================================================================
//
// CurlPDFDocBuilder.h
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
//
//========================================================================
#ifndef CURLPDFDOCBUILDER_H
#define CURLPDFDOCBUILDER_H
#include "PDFDocBuilder.h"
//------------------------------------------------------------------------
// CurlPDFDocBuilder
//------------------------------------------------------------------------
class CurlPDFDocBuilder : public PDFDocBuilder {
public:
PDFDoc *buildPDFDoc(GooString* uri, GooString *ownerPassword = NULL,
GooString *userPassword = NULL, void *guiDataA = NULL);
GBool supports(GooString* uri);
};
#endif /* CURLPDFDOCBUILDER_H */
......@@ -111,10 +111,12 @@ libcurl_includes = \
$(LIBCURL_CFLAGS)
curl_headers = \
CurlCachedFile.h
CurlCachedFile.h \
CurlPDFDocBuilder.h
curl_sources = \
CurlCachedFile.cc
CurlCachedFile.cc \
CurlPDFDocBuilder.cc
endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment