blob: 5b02b14a78428c7d5a9f9f3f91b963ab95b6c0ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
//========================================================================
//
// CurlPDFDocBuilder.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
// Copyright 2010 Albert Astals Cid <aacid@kde.org>
//
//========================================================================
#include <config.h>
#include "CurlPDFDocBuilder.h"
#include "CachedFile.h"
#include "CurlCachedFile.h"
//------------------------------------------------------------------------
// CurlPDFDocBuilder
//------------------------------------------------------------------------
PDFDoc *
CurlPDFDocBuilder::buildPDFDoc(const GooString &uri,
GooString *ownerPassword, GooString *userPassword, void *guiDataA)
{
Object obj;
CachedFile *cachedFile = new CachedFile(
new CurlCachedFileLoader(), uri.copy());
obj.initNull();
BaseStream *str = new CachedFileStream(
cachedFile, 0, gFalse, cachedFile->getLength(), &obj);
return new PDFDoc(str, ownerPassword, userPassword, guiDataA);
}
GBool CurlPDFDocBuilder::supports(const GooString &uri)
{
if (uri.cmpN("http://", 7) == 0 || uri.cmpN("https://", 8) == 0) {
return gTrue;
} else {
return gFalse;
}
}
|