Lines 26-50
Link Here
|
26 |
#include <stdio.h> |
26 |
#include <stdio.h> |
27 |
#include <string.h> |
27 |
#include <string.h> |
28 |
#include <ctype.h> |
28 |
#include <ctype.h> |
29 |
#include <aconf.h> |
|
|
30 |
#include <GString.h> |
31 |
#include <gmem.h> |
32 |
#include <gfile.h> |
33 |
#include <config.h> |
34 |
#include <assert.h> |
29 |
#include <assert.h> |
35 |
#include "Object.h" |
30 |
#include <dirent.h> |
36 |
#include "Stream.h" |
31 |
#include <poppler/poppler-config.h> |
37 |
#include "Array.h" |
32 |
#include <poppler/goo/GooString.h> |
38 |
#include "Dict.h" |
33 |
#include <poppler/goo/gmem.h> |
39 |
#include "XRef.h" |
34 |
#include <poppler/goo/gfile.h> |
40 |
#include "Catalog.h" |
35 |
#include "poppler/Object.h" |
41 |
#include "Link.h" |
36 |
#include "poppler/UGooString.h" |
42 |
#include "Page.h" |
37 |
#include "poppler/Stream.h" |
43 |
#include "GfxFont.h" |
38 |
#include "poppler/Array.h" |
44 |
#include "PDFDoc.h" |
39 |
#include "poppler/Dict.h" |
45 |
#include "GlobalParams.h" |
40 |
#include "poppler/XRef.h" |
46 |
#include "Error.h" |
41 |
#include "poppler/Link.h" |
47 |
|
42 |
#include "poppler/Catalog.h" |
|
|
43 |
#include "poppler/Page.h" |
44 |
#include "poppler/GfxFont.h" |
45 |
#include "poppler/PDFDoc.h" |
46 |
#include "poppler/GlobalParams.h" |
47 |
#include "poppler/Error.h" |
48 |
#include "epdf.h" |
48 |
#include "epdf.h" |
49 |
|
49 |
|
50 |
// This file is mostly C and not very much C++; it's just used to interface |
50 |
// This file is mostly C and not very much C++; it's just used to interface |
Lines 169-175
Link Here
|
169 |
fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name, |
169 |
fprintf(stderr, "\npdfTeX Debug: Creating %s (%d)\n", p->file_name, |
170 |
p->occurences); |
170 |
p->occurences); |
171 |
#endif |
171 |
#endif |
172 |
GString *docName = new GString(p->file_name); |
172 |
GooString *docName = new GooString(p->file_name); |
173 |
p->doc = new PDFDoc(docName); // takes ownership of docName |
173 |
p->doc = new PDFDoc(docName); // takes ownership of docName |
174 |
if (!p->doc->isOk() || !p->doc->okToPrint()) { |
174 |
if (!p->doc->isOk() || !p->doc->okToPrint()) { |
175 |
pdftex_fail("xpdf: reading PDF image failed"); |
175 |
pdftex_fail("xpdf: reading PDF image failed"); |
Lines 212-218
Link Here
|
212 |
obj->initDict(xref); |
212 |
obj->initDict(xref); |
213 |
for (int i = 0, l = dict->getLength(); i < l; i++) { |
213 |
for (int i = 0, l = dict->getLength(); i < l; i++) { |
214 |
Object obj1; |
214 |
Object obj1; |
215 |
obj->dictAdd(copyString(dict->getKey(i)), dict->getValNF(i, &obj1)); |
215 |
obj->dictAdd(*(new UGooString (*dict->getKey(i))), dict->getValNF(i, &obj1)); |
216 |
} |
216 |
} |
217 |
} |
217 |
} |
218 |
|
218 |
|
Lines 291-297
Link Here
|
291 |
static void copyDictEntry(Object * obj, int i) |
291 |
static void copyDictEntry(Object * obj, int i) |
292 |
{ |
292 |
{ |
293 |
PdfObject obj1; |
293 |
PdfObject obj1; |
294 |
copyName(obj->dictGetKey(i)); |
294 |
copyName(obj->dictGetKey(i)->getCString()); |
295 |
pdf_puts(" "); |
295 |
pdf_puts(" "); |
296 |
obj->dictGetValNF(i, &obj1); |
296 |
obj->dictGetValNF(i, &obj1); |
297 |
copyObject(&obj1); |
297 |
copyObject(&obj1); |
Lines 318-324
Link Here
|
318 |
pdf_puts("<<\n"); |
318 |
pdf_puts("<<\n"); |
319 |
assert(r->type == objFont); // FontDescriptor is in fd_tree |
319 |
assert(r->type == objFont); // FontDescriptor is in fd_tree |
320 |
for (i = 0, l = obj->dictGetLength(); i < l; ++i) { |
320 |
for (i = 0, l = obj->dictGetLength(); i < l; ++i) { |
321 |
key = obj->dictGetKey(i); |
321 |
key = obj->dictGetKey(i)->getCString(); |
322 |
if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0 |
322 |
if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0 |
323 |
|| strncmp("BaseFont", key, strlen("BaseFont")) == 0 |
323 |
|| strncmp("BaseFont", key, strlen("BaseFont")) == 0 |
324 |
|| strncmp("Encoding", key, strlen("Encoding")) == 0) |
324 |
|| strncmp("Encoding", key, strlen("Encoding")) == 0) |
Lines 424-430
Link Here
|
424 |
for (i = 0, l = obj->dictGetLength(); i < l; ++i) { |
424 |
for (i = 0, l = obj->dictGetLength(); i < l; ++i) { |
425 |
obj->dictGetValNF(i, &fontRef); |
425 |
obj->dictGetValNF(i, &fontRef); |
426 |
if (fontRef->isRef()) |
426 |
if (fontRef->isRef()) |
427 |
copyFont(obj->dictGetKey(i), &fontRef); |
427 |
copyFont(obj->dictGetKey(i)->getCString(), &fontRef); |
428 |
else |
428 |
else |
429 |
pdftex_fail("PDF inclusion: invalid font in reference type <%s>", |
429 |
pdftex_fail("PDF inclusion: invalid font in reference type <%s>", |
430 |
fontRef->getTypeName()); |
430 |
fontRef->getTypeName()); |
Lines 511-517
Link Here
|
511 |
int i, l, c; |
511 |
int i, l, c; |
512 |
Ref ref; |
512 |
Ref ref; |
513 |
char *p; |
513 |
char *p; |
514 |
GString *s; |
514 |
GooString *s; |
515 |
if (obj->isBool()) { |
515 |
if (obj->isBool()) { |
516 |
pdf_printf("%s", obj->getBool()? "true" : "false"); |
516 |
pdf_printf("%s", obj->getBool()? "true" : "false"); |
517 |
} else if (obj->isInt()) { |
517 |
} else if (obj->isInt()) { |
Lines 677-683
Link Here
|
677 |
float pdf_version_found, pdf_version_wanted; |
677 |
float pdf_version_found, pdf_version_wanted; |
678 |
// initialize |
678 |
// initialize |
679 |
if (!isInit) { |
679 |
if (!isInit) { |
680 |
globalParams = new GlobalParams(); |
680 |
globalParams = new GlobalParams(NULL); |
681 |
globalParams->setErrQuiet(gFalse); |
681 |
globalParams->setErrQuiet(gFalse); |
682 |
isInit = gTrue; |
682 |
isInit = gTrue; |
683 |
} |
683 |
} |
Lines 703-709
Link Here
|
703 |
epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages(); |
703 |
epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages(); |
704 |
if (page_name) { |
704 |
if (page_name) { |
705 |
// get page by name |
705 |
// get page by name |
706 |
GString name(page_name); |
706 |
UGooString name(page_name); |
707 |
LinkDest *link = pdf_doc->doc->findDest(&name); |
707 |
LinkDest *link = pdf_doc->doc->findDest(&name); |
708 |
if (link == 0 || !link->isOk()) |
708 |
if (link == 0 || !link->isOk()) |
709 |
pdftex_fail("PDF inclusion: invalid destination <%s>", page_name); |
709 |
pdftex_fail("PDF inclusion: invalid destination <%s>", page_name); |
Lines 924-930
Link Here
|
924 |
pdf_puts("/Resources <<\n"); |
924 |
pdf_puts("/Resources <<\n"); |
925 |
for (i = 0, l = obj1->dictGetLength(); i < l; ++i) { |
925 |
for (i = 0, l = obj1->dictGetLength(); i < l; ++i) { |
926 |
obj1->dictGetVal(i, &obj2); |
926 |
obj1->dictGetVal(i, &obj2); |
927 |
key = obj1->dictGetKey(i); |
927 |
key = obj1->dictGetKey(i)->getCString(); |
928 |
if (strcmp("Font", key) == 0) |
928 |
if (strcmp("Font", key) == 0) |
929 |
copyFontResources(&obj2); |
929 |
copyFontResources(&obj2); |
930 |
else if (strcmp("ProcSet", key) == 0) |
930 |
else if (strcmp("ProcSet", key) == 0) |