|
|
cc05f0 |
--- cups-filters-1.20.0/filter/pdf.cxx
|
|
|
cc05f0 |
+++ cups-filters-1.20.0/filter/pdf.cxx
|
|
|
cc05f0 |
@@ -87,7 +87,11 @@ static EMB_PARAMS *Font;
|
|
|
cc05f0 |
extern "C" pdf_t * pdf_load_template(const char *filename)
|
|
|
cc05f0 |
{
|
|
|
cc05f0 |
/* Init poppler */
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 83
|
|
|
cc05f0 |
+ globalParams.reset(new GlobalParams());
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
globalParams = new GlobalParams();
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
PDFDoc *doc = new PDFDoc(new GooString(filename));
|
|
|
cc05f0 |
|
|
|
cc05f0 |
@@ -136,7 +140,7 @@ extern "C" void pdf_prepend_stream(pdf_t
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
if (!pageobj.isDict() ||
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- (contents = pageobj.dictLookupNF("Contents")).isNull()
|
|
|
cc05f0 |
+ (contents = pageobj.dictLookupNF("Contents").copy()).isNull()
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
!pageobj.dictLookupNF("Contents", &contents)
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
@@ -166,11 +170,15 @@ extern "C" void pdf_prepend_stream(pdf_t
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
r = xref->addIndirectObject(&stream);
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ streamrefobj = Object(r);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
streamrefobj = Object(r.num, r.gen);
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
streamrefobj.initRef(r.num, r.gen);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
array = Object(new Array(xref));
|
|
|
cc05f0 |
@@ -182,7 +190,7 @@ extern "C" void pdf_prepend_stream(pdf_t
|
|
|
cc05f0 |
|
|
|
cc05f0 |
if (contents.isStream()) {
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- contents = pageobj.dictLookupNF("Contents"); // streams must be indirect, i.e. not fetch()-ed
|
|
|
cc05f0 |
+ contents = pageobj.dictLookupNF("Contents").copy(); // streams must be indirect, i.e. not fetch()-ed
|
|
|
cc05f0 |
array.arrayAdd(std::move(contents));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
pageobj.dictLookupNF("Contents", &contents); // streams must be indirect, i.e. not fetch()-ed
|
|
|
cc05f0 |
@@ -194,7 +202,7 @@ extern "C" void pdf_prepend_stream(pdf_t
|
|
|
cc05f0 |
Object obj;
|
|
|
cc05f0 |
for (i = 0; i < len; i++) {
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- obj = contents.arrayGetNF(i);
|
|
|
cc05f0 |
+ obj = contents.arrayGetNF(i).copy();
|
|
|
cc05f0 |
array.arrayAdd(std::move(obj));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
contents.arrayGetNF(i, &obj);
|
|
|
cc05f0 |
@@ -258,7 +266,7 @@ static Object * get_resource_dict(XRef *
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* TODO resource dict can also be inherited */
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- res = pagedict->lookupNF("Resources");
|
|
|
cc05f0 |
+ res = pagedict->lookupNF("Resources").copy();
|
|
|
cc05f0 |
if (res.isNull())
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
if (!pagedict->lookupNF("Resources", &res))
|
|
|
cc05f0 |
@@ -331,7 +339,7 @@ extern "C" void pdf_add_type1_font(pdf_t
|
|
|
cc05f0 |
xref->addIndirectObject(&font);
|
|
|
cc05f0 |
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- fonts = resdict.dictLookupNF("Font");
|
|
|
cc05f0 |
+ fonts = resdict.dictLookupNF("Font").copy();
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
resdict.dictLookupNF("Font", &fonts);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
@@ -540,7 +548,7 @@ extern "C" void pdf_duplicate_page (pdf_
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- parentref = page.dictLookupNF("Parent");
|
|
|
cc05f0 |
+ parentref = page.dictLookupNF("Parent").copy();
|
|
|
cc05f0 |
parent = parentref.fetch(xref);
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
page.dictLookupNF("Parent", &parentref);
|
|
|
cc05f0 |
@@ -568,6 +576,9 @@ extern "C" void pdf_duplicate_page (pdf_
|
|
|
cc05f0 |
// the pages tree (not supported by major pdf implementations).
|
|
|
cc05f0 |
for (i = 1; i < count; i++) {
|
|
|
cc05f0 |
Ref r = xref->addIndirectObject(&page);
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ kids.arrayAdd(Object(r));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
kids.arrayAdd(Object(r.num, r.gen));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
@@ -575,6 +586,7 @@ extern "C" void pdf_duplicate_page (pdf_
|
|
|
cc05f0 |
kids.arrayAdd(&ref;;
|
|
|
cc05f0 |
ref.free();
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
@@ -734,7 +746,7 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
FormField *ff = fm_text->getField();
|
|
|
cc05f0 |
- GooString *field_name;
|
|
|
cc05f0 |
+ const GooString *field_name;
|
|
|
cc05f0 |
field_name = ff->getFullyQualifiedName();
|
|
|
cc05f0 |
if ( ! field_name )
|
|
|
cc05f0 |
field_name = ff->getPartialName();
|
|
|
cc05f0 |
@@ -743,7 +755,11 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
continue;
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
|
|
|
cc05f0 |
+ const char *name = field_name->c_str();
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
const char *name = field_name->getCString();
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
const char *fill_with = lookup_opt(opt, name);
|
|
|
cc05f0 |
if ( ! fill_with ) {
|
|
|
cc05f0 |
fprintf(stderr, "Lack information for widget: %s.\n", name);
|
|
|
cc05f0 |
@@ -831,6 +847,9 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("Type", name_object("XObject"));
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("Subtype", name_object("Form"));
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("FormType", int_object(1));
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ appearance_stream_dic.dictSet("Resources", Object(resref));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("Resources", Object(resref.num, resref.gen));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
@@ -838,6 +857,7 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
obj_ref_x.initRef(resref.num, resref.gen);
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("Resources", &obj_ref_x);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* BBox array: TODO. currently out of the head. */
|
|
|
cc05f0 |
Object array;
|
|
|
cc05f0 |
@@ -851,8 +871,13 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("BBox", std::move(array));
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("Length", Object(appearance_stream->getLength()));
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
|
|
|
cc05f0 |
+ MemStream *mem_stream = new MemStream(appearance_stream->c_str(),
|
|
|
cc05f0 |
+ 0, appearance_stream->getLength(), std::move(appearance_stream_dic));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
MemStream *mem_stream = new MemStream(appearance_stream->getCString(),
|
|
|
cc05f0 |
0, appearance_stream->getLength(), std::move(appearance_stream_dic));
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* Make obj stream */
|
|
|
cc05f0 |
Object stream = Object(static_cast<Stream *>(mem_stream));
|
|
|
cc05f0 |
@@ -860,8 +885,11 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
Ref r = xref->addIndirectObject(&stream);
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* Update Xref table */
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ Object obj_ref = Object(r);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
Object obj_ref = Object(r.num, r.gen);
|
|
|
cc05f0 |
-
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
/*
|
|
|
cc05f0 |
* Fill Annotation's appearance streams dic /AP
|
|
|
cc05f0 |
* See: 8.4.4 Appearance Streams
|
|
|
cc05f0 |
@@ -884,8 +912,13 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("BBox", &array);
|
|
|
cc05f0 |
appearance_stream_dic.dictSet("Length", int_object(appearance_stream->getLength()));
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
|
|
|
cc05f0 |
+ MemStream *mem_stream = new MemStream(appearance_stream->c_str(),
|
|
|
cc05f0 |
+ 0, appearance_stream->getLength(), &appearance_stream_dic);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
MemStream *mem_stream = new MemStream(appearance_stream->getCString(),
|
|
|
cc05f0 |
0, appearance_stream->getLength(), &appearance_stream_dic);
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* Make obj stream */
|
|
|
cc05f0 |
Object stream;
|
|
|
cc05f0 |
@@ -925,10 +958,10 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
*/
|
|
|
cc05f0 |
Object *obj_form = catalog->getAcroForm();
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- obj_form->dictSet("NeedAppearances", Object(gFalse));
|
|
|
cc05f0 |
+ obj_form->dictSet("NeedAppearances", Object(false));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
Object obj1;
|
|
|
cc05f0 |
- obj1.initBool(gFalse);
|
|
|
cc05f0 |
+ obj1.initBool(false);
|
|
|
cc05f0 |
obj_form->dictSet("NeedAppearances", &obj1);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
@@ -948,7 +981,11 @@ extern "C" int pdf_fill_form(pdf_t *doc,
|
|
|
cc05f0 |
catRef.gen = xref->getRootGen();
|
|
|
cc05f0 |
catRef.num = xref->getRootNum();
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ catObj.dictSet("AcroForm", Object(ref_form));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
catObj.dictSet("AcroForm", Object(ref_form.num, ref_form.gen));
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
xref->setModifiedObject(&catObj, catRef);
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
Object obj2;
|
|
|
cc05f0 |
@@ -1020,12 +1057,22 @@ static int pdf_embed_font(pdf_t *doc,
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* Create memory stream font. Add it to font dic. */
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
|
|
|
cc05f0 |
+ MemStream *mem_stream = new MemStream(font_stream->c_str(),
|
|
|
cc05f0 |
+ 0, outlen, std::move(f_dic));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
MemStream *mem_stream = new MemStream(font_stream->getCString(),
|
|
|
cc05f0 |
0, outlen, std::move(f_dic));
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
Object stream = Object(static_cast<Stream *>(mem_stream));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
|
|
|
cc05f0 |
+ MemStream *mem_stream = new MemStream(font_stream->c_str(),
|
|
|
cc05f0 |
+ 0, outlen, &f_dic);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
MemStream *mem_stream = new MemStream(font_stream->getCString(),
|
|
|
cc05f0 |
0, outlen, &f_dic);
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* Make obj stream */
|
|
|
cc05f0 |
Object stream;
|
|
|
cc05f0 |
@@ -1066,7 +1113,7 @@ static int pdf_embed_font(pdf_t *doc,
|
|
|
cc05f0 |
Object fonts;
|
|
|
cc05f0 |
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
- fonts = resdict.dictLookupNF("Font");
|
|
|
cc05f0 |
+ fonts = resdict.dictLookupNF("Font").copy();
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
resdict.dictLookupNF("Font", &fonts);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
@@ -1074,7 +1121,7 @@ static int pdf_embed_font(pdf_t *doc,
|
|
|
cc05f0 |
/* Create new one, if doesn't exists */
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
resdict.dictSet("Font", Object(new Dict(xref)));
|
|
|
cc05f0 |
- fonts = resdict.dictLookupNF("Font");
|
|
|
cc05f0 |
+ fonts = resdict.dictLookupNF("Font").copy();
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
fonts.initDict(xref);
|
|
|
cc05f0 |
resdict.dictSet("Font", &fonts);
|
|
|
cc05f0 |
@@ -1108,11 +1155,15 @@ static int pdf_embed_font(pdf_t *doc,
|
|
|
cc05f0 |
|
|
|
cc05f0 |
/* r - cid resource dic */
|
|
|
cc05f0 |
Object font_res_obj_ref;
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ font_res_obj_ref = Object(r);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
font_res_obj_ref = Object(r.num, r.gen);
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
font_res_obj_ref.initRef(r.num, r.gen);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
Object *fonts_dic;
|
|
|
cc05f0 |
Object dereferenced_obj;
|
|
|
cc05f0 |
@@ -1440,6 +1491,9 @@ static Object *make_fontdescriptor_dic(
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ dic->dictSet(emb_pdf_get_fontfile_key(emb), Object(fontfile_obj_ref));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
dic->dictSet(emb_pdf_get_fontfile_key(emb), Object(fontfile_obj_ref.num, fontfile_obj_ref.gen));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
@@ -1447,6 +1501,7 @@ static Object *make_fontdescriptor_dic(
|
|
|
cc05f0 |
ref_obj.initRef(fontfile_obj_ref.num, fontfile_obj_ref.gen);
|
|
|
cc05f0 |
dic->dictSet(emb_pdf_get_fontfile_key(emb), &ref_obj);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
return dic;
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
@@ -1480,6 +1535,9 @@ static Object *make_font_dic(
|
|
|
cc05f0 |
"BaseFont",
|
|
|
cc05f0 |
name_object(copyString(emb_pdf_escape_name(fdes->fontname,-1))));
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ dic->dictSet("FontDescriptor", Object(fontdescriptor_obj_ref));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
dic->dictSet("FontDescriptor", Object(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen));
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
@@ -1487,6 +1545,7 @@ static Object *make_font_dic(
|
|
|
cc05f0 |
ref_obj.initRef(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen);
|
|
|
cc05f0 |
dic->dictSet("FontDescriptor", &ref_obj);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
if ( emb->plan & EMB_A_MULTIBYTE ) {
|
|
|
cc05f0 |
assert(fwid->warray);
|
|
|
cc05f0 |
@@ -1573,17 +1632,26 @@ static Object *make_cidfont_dic(
|
|
|
cc05f0 |
basefont->append(addenc);
|
|
|
cc05f0 |
basefont->append((addenc[0])?encoding:"");
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
|
|
|
cc05f0 |
+ dic->dictSet("BaseFont",
|
|
|
cc05f0 |
+ name_object(copyString(basefont->c_str())));
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
dic->dictSet("BaseFont",
|
|
|
cc05f0 |
name_object(copyString(basefont->getCString())));
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
dic->dictSet("Encoding", name_object(copyString(encoding)));
|
|
|
cc05f0 |
|
|
|
cc05f0 |
Object obj;
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
|
|
|
cc05f0 |
+ obj = Object(fontdescriptor_obj_ref);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
obj = Object(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen);
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
obj.initRef(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
Object array;
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
|
|
|
cc05f0 |
--- cups-filters-1.20.0/filter/pdftoraster.cxx
|
|
|
cc05f0 |
+++ cups-filters-1.20.0/filter/pdftoraster.cxx
|
|
|
cc05f0 |
@@ -282,8 +282,13 @@ cmsHPROFILE sgray_profile()
|
|
|
cc05f0 |
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 85
|
|
|
cc05f0 |
+void CDECL myErrorFun(ErrorCategory category,
|
|
|
cc05f0 |
+ Goffset pos, const char *msg)
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
void CDECL myErrorFun(void *data, ErrorCategory category,
|
|
|
cc05f0 |
Goffset pos, char *msg)
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
void CDECL myErrorFun(void *data, ErrorCategory category,
|
|
|
cc05f0 |
int pos, char *msg)
|
|
|
cc05f0 |
@@ -412,9 +417,9 @@ static GBool getColorProfilePath(ppd_fil
|
|
|
cc05f0 |
path->append("/profiles/");
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
path->append(attr->value);
|
|
|
cc05f0 |
- return gTrue;
|
|
|
cc05f0 |
+ return true;
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
- return gFalse;
|
|
|
cc05f0 |
+ return false;
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
@@ -1686,7 +1691,7 @@ static void outPage(PDFDoc *doc, Catalog
|
|
|
cc05f0 |
{
|
|
|
cc05f0 |
SplashBitmap *bitmap;
|
|
|
cc05f0 |
Page *page = catalog->getPage(pageNo);
|
|
|
cc05f0 |
- PDFRectangle *mediaBox = page->getMediaBox();
|
|
|
cc05f0 |
+ const PDFRectangle *mediaBox = page->getMediaBox();
|
|
|
cc05f0 |
int rotate = page->getRotate();
|
|
|
cc05f0 |
double paperdimensions[2], /* Physical size of the paper */
|
|
|
cc05f0 |
margins[4]; /* Physical margins of print */
|
|
|
cc05f0 |
@@ -1814,7 +1819,7 @@ static void outPage(PDFDoc *doc, Catalog
|
|
|
cc05f0 |
|
|
|
cc05f0 |
doc->displayPage(out,pageNo,header.HWResolution[0],
|
|
|
cc05f0 |
header.HWResolution[1],(landscape == 0 ? 0 : 90),
|
|
|
cc05f0 |
- gTrue,gTrue,gTrue);
|
|
|
cc05f0 |
+ true,true,true);
|
|
|
cc05f0 |
bitmap = out->getBitmap();
|
|
|
cc05f0 |
bitmapoffset[0] = margins[0] / 72.0 * header.HWResolution[0];
|
|
|
cc05f0 |
bitmapoffset[1] = margins[3] / 72.0 * header.HWResolution[1];
|
|
|
cc05f0 |
@@ -1867,7 +1872,7 @@ static void outPage(PDFDoc *doc, Catalog
|
|
|
cc05f0 |
writePageImage(raster,bitmap,pageNo);
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
-static void setPopplerColorProfile()
|
|
|
cc05f0 |
+static void setPopplerColorProfile(SplashOutputDev *out)
|
|
|
cc05f0 |
{
|
|
|
cc05f0 |
if (header.cupsBitsPerColor != 8 && header.cupsBitsPerColor != 16) {
|
|
|
cc05f0 |
/* color Profile is not supported */
|
|
|
cc05f0 |
@@ -1951,7 +1956,13 @@ static void setPopplerColorProfile()
|
|
|
cc05f0 |
break;
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
if (popplerColorProfile != NULL) {
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 90
|
|
|
cc05f0 |
+#ifdef USE_CMS
|
|
|
cc05f0 |
+ out->setDisplayProfile(make_GfxLCMSProfilePtr(popplerColorProfile));
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
GfxColorSpace::setDisplayProfile(popplerColorProfile);
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
@@ -1966,13 +1977,21 @@ int main(int argc, char *argv[]) {
|
|
|
cc05f0 |
int rowpad;
|
|
|
cc05f0 |
Catalog *catalog;
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 85
|
|
|
cc05f0 |
+ setErrorCallback(::myErrorFun);
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
|
|
|
cc05f0 |
setErrorCallback(::myErrorFun,NULL);
|
|
|
cc05f0 |
#else
|
|
|
cc05f0 |
setErrorFunction(::myErrorFun);
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
cmsSetLogErrorHandler(lcmsErrorHandler);
|
|
|
cc05f0 |
- globalParams = new GlobalParams();
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 83
|
|
|
cc05f0 |
+ globalParams.reset(new GlobalParams());
|
|
|
cc05f0 |
+#else
|
|
|
cc05f0 |
+ globalParams = new GlobalParams();
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
parseOpts(argc, argv);
|
|
|
cc05f0 |
|
|
|
cc05f0 |
if (argc == 6) {
|
|
|
cc05f0 |
@@ -2119,14 +2138,10 @@ int main(int argc, char *argv[]) {
|
|
|
cc05f0 |
break;
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
- if (!cm_disabled) {
|
|
|
cc05f0 |
- setPopplerColorProfile();
|
|
|
cc05f0 |
- }
|
|
|
cc05f0 |
-
|
|
|
cc05f0 |
out = new SplashOutputDev(cmode,rowpad/* row padding */,
|
|
|
cc05f0 |
- gFalse,paperColor,gTrue
|
|
|
cc05f0 |
+ false,paperColor,true
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 30
|
|
|
cc05f0 |
- ,gFalse
|
|
|
cc05f0 |
+ ,false
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
);
|
|
|
cc05f0 |
#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
|
|
|
cc05f0 |
@@ -2135,6 +2150,10 @@ int main(int argc, char *argv[]) {
|
|
|
cc05f0 |
out->startDoc(doc->getXRef());
|
|
|
cc05f0 |
#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+ if (!cm_disabled) {
|
|
|
cc05f0 |
+ setPopplerColorProfile(out);
|
|
|
cc05f0 |
+ }
|
|
|
cc05f0 |
+
|
|
|
cc05f0 |
if ((raster = cupsRasterOpen(1, pwgraster ? CUPS_RASTER_WRITE_PWG :
|
|
|
cc05f0 |
CUPS_RASTER_WRITE)) == 0) {
|
|
|
cc05f0 |
pdfError(-1,const_cast<char *>("Can't open raster stream"));
|
|
|
cc05f0 |
@@ -2162,9 +2181,11 @@ err1:
|
|
|
cc05f0 |
cmsDeleteTransform(colorTransform);
|
|
|
cc05f0 |
}
|
|
|
cc05f0 |
|
|
|
cc05f0 |
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 68
|
|
|
cc05f0 |
// Check for memory leaks
|
|
|
cc05f0 |
Object::memCheck(stderr);
|
|
|
cc05f0 |
gMemReport(stderr);
|
|
|
cc05f0 |
+#endif
|
|
|
cc05f0 |
|
|
|
cc05f0 |
return exitCode;
|
|
|
cc05f0 |
}
|