pdf-parser.cpp revision f372fdf1afe5aa74ec2e97933306297c0ae4c0ce
/*
* PDF parsing using libpoppler.
*
* Derived from poppler's Gfx.cc
*
* Authors:
* Jon A. Cruz <jon@joncruz.org>
*
* Copyright 2012 authors
* Copyright 1996-2003 Glyph & Cog, LLC
*
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#ifdef HAVE_POPPLER
#ifdef USE_GCC_PRAGMAS
#pragma implementation
#endif
extern "C" {
#include <stdlib.h>
#include <stdio.h>
#include <stddef.h>
#include <string.h>
#include <math.h>
}
#include "svg-builder.h"
#include "Gfx.h"
#include "pdf-parser.h"
#include "goo/GooTimer.h"
#include "GlobalParams.h"
#include "CharTypes.h"
#include "Object.h"
#include "Array.h"
#include "Dict.h"
#include "Stream.h"
#include "Lexer.h"
#include "Parser.h"
#include "GfxFont.h"
#include "GfxState.h"
#include "OutputDev.h"
#include "Page.h"
#include "Annot.h"
#include "Error.h"
// the MSVC math.h doesn't define this
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
//------------------------------------------------------------------------
// constants
//------------------------------------------------------------------------
// Default max delta allowed in any color component for a shading fill.
// Default max recursive depth for a shading fill.
#define defaultShadingMaxDepth 6
// Max number of operators kept in the history list.
#define maxOperatorHistoryDepth 16
//------------------------------------------------------------------------
// Operator table
//------------------------------------------------------------------------
{"B", 0, {tchkNone},
{"B*", 0, {tchkNone},
{"BI", 0, {tchkNone},
{"BT", 0, {tchkNone},
&PdfParser::opBeginText},
{"BX", 0, {tchkNone},
&PdfParser::opMarkPoint},
{"EI", 0, {tchkNone},
&PdfParser::opEndImage},
{"EMC", 0, {tchkNone},
{"ET", 0, {tchkNone},
{"EX", 0, {tchkNone},
{"F", 0, {tchkNone},
{"ID", 0, {tchkNone},
&PdfParser::opImageData},
&PdfParser::opMarkPoint},
{"Q", 0, {tchkNone},
{"S", 0, {tchkNone},
tchkSCN},
{"T*", 0, {tchkNone},
&PdfParser::opTextMove},
&PdfParser::opShowText},
{"W", 0, {tchkNone},
{"W*", 0, {tchkNone},
{"b", 0, {tchkNone},
{"b*", 0, {tchkNone},
{"f", 0, {tchkNone},
{"f*", 0, {tchkNone},
{"h", 0, {tchkNone},
&PdfParser::opClosePath},
{"n", 0, {tchkNone},
{"q", 0, {tchkNone},
&PdfParser::opRectangle},
{"s", 0, {tchkNone},
tchkSCN},
&PdfParser::opCurveTo1},
};
namespace {
{
return patch;
}
} // namespace
//------------------------------------------------------------------------
// ClipHistoryEntry
//------------------------------------------------------------------------
class ClipHistoryEntry {
public:
virtual ~ClipHistoryEntry();
// Manipulate clip path stack
ClipHistoryEntry *save();
private:
};
//------------------------------------------------------------------------
// PdfParser
//------------------------------------------------------------------------
int /*pageNum*/,
int rotate,
PDFRectangle *cropBox) :
printCommands(false),
ignoreUndef(0),
baseMatrix(),
formDepth(0),
colorDeltas(),
maxDepths(),
clipHistory(new ClipHistoryEntry()),
{
double scaledCTM[6];
for (int i = 0; i < 6; ++i) {
baseMatrix[i] = ctm[i];
}
saveState();
formDepth = 0;
// set crop box
if (cropBox) {
if (printCommands)
// do not clip if it's not needed
}
}
pushOperator("startPage");
}
PDFRectangle *box) :
printCommands(false),
ignoreUndef(0),
baseMatrix(),
formDepth(0),
colorDeltas(),
maxDepths(),
clipHistory(new ClipHistoryEntry()),
{
for (int i = 0; i < 6; ++i) {
}
formDepth = 0;
}
while(operatorHistory) {
delete operatorHistory;
}
restoreState();
}
if (!subPage) {
//out->endPage();
}
while (res) {
popResources();
}
if (state) {
delete state;
}
if (clipHistory) {
delete clipHistory;
clipHistory = NULL;
}
}
for (int i = 0; i < obj->arrayGetLength(); ++i) {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
delete parser;
}
{
// scan a sequence of objects
int numArgs = 0;
// got a command - execute it
if (printCommands) {
for (int i = 0; i < numArgs; ++i) {
printf(" ");
}
printf("\n");
}
// Run the operation
for (int i = 0; i < numArgs; ++i)
numArgs = 0;
// got an argument - save it
// too many arguments - something is wrong
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
if (printCommands) {
printf("throwing away arg: ");
printf("\n");
}
}
// grab the next object
}
// args at end with no command
if (numArgs > 0) {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
if (printCommands) {
for (int i = 0; i < numArgs; ++i) {
printf(" ");
}
printf("\n");
}
for (int i = 0; i < numArgs; ++i)
}
}
{
// Truncate list if needed
}
if (prev) {
delete curr;
}
}
}
}
}
} else {
return "";
}
}
char *name;
int i;
// find operator
if (ignoreUndef == 0)
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
// type check args
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
#if 0
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
#endif
}
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
for (i = 0; i < numArgs; ++i) {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
// add to history
// do it
}
int a = -1;
int b = numOps;
int cmp = -1;
// invariant: opTab[a] < name < opTab[b]
while (b - a > 1) {
const int m = (a + b) / 2;
if (cmp < 0)
a = m;
else if (cmp > 0)
b = m;
else
a = b = m;
}
if (cmp != 0)
return NULL;
return &opTab[a];
}
switch (type) {
}
return gFalse;
}
}
//------------------------------------------------------------------------
// graphics state operators
//------------------------------------------------------------------------
{
saveState();
}
{
restoreState();
}
// TODO not good that numArgs is ignored but args[] is used:
{
const char *prevOp = getPreviousOperator();
// multiply it with the previous transform
double otherMatrix[6];
// construct identity matrix
}
} else {
}
fontChanged = gTrue;
}
// TODO not good that numArgs is ignored but args[] is used:
{
double *dash = 0;
if (length != 0) {
for (int i = 0; i < length; ++i) {
}
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
return;
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
if (printCommands) {
printf(" gfx state dict: ");
printf("\n");
}
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
}
}
}
}
if (!haveFillOP) {
}
}
// stroke adjust
}
// transfer function
}
int pos = 4;
for (int i = 0; i < 4; ++i) {
if (!funcs[i]) {
pos = i;
break;
}
}
if (pos == 4) {
}
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
// soft mask
} else { // "Luminosity"
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
delete funcs[0];
}
}
for (int i = 0; i < gfxColorMaxComps; ++i) {
backdropColor.c[i] = 0;
}
}
}
}
#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
#else
#endif
}
}
}
if (!haveBackdropColor) {
if (blendingColorSpace) {
} else {
//~ need to get the parent or default color space (?)
for (int i = 0; i < gfxColorMaxComps; ++i) {
backdropColor.c[i] = 0;
}
}
}
if (funcs[0]) {
delete funcs[0];
}
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
}
}
int i;
// check for excessive recursion
if (formDepth > 20) {
return;
}
// get stream dict
// check form type
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
// get bounding box
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
for (i = 0; i < 4; ++i) {
}
// get matrix
for (i = 0; i < 6; ++i) {
}
} else {
m[0] = 1; m[1] = 0;
m[2] = 0; m[3] = 1;
m[4] = 0; m[5] = 0;
}
// get resources
// draw it
++formDepth;
--formDepth;
if (blendingColorSpace) {
delete blendingColorSpace;
}
}
{
}
//------------------------------------------------------------------------
// color operators
//------------------------------------------------------------------------
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
int i;
for (i = 0; i < 4; ++i) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
for (int i = 0; i < 4; ++i) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
for (int i = 0; i < 3; ++i) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
for (int i = 0; i < 3; ++i) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
GfxColorSpace *colorSpace = 0;
#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
} else {
}
#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
} else {
}
} else {
}
#else
} else {
}
#endif
if (colorSpace) {
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
GfxColorSpace *colorSpace = 0;
#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
} else {
}
#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
} else {
}
} else {
}
#else
} else {
}
#endif
if (colorSpace) {
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
}
int i;
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
for (i = 0; i < numArgs; ++i) {
}
}
int i;
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
for (i = 0; i < numArgs; ++i) {
}
}
int i;
if (numArgs > 1) {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
}
}
#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
}
}
#else
}
#endif
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) {
}
}
}
}
int i;
if (numArgs > 1) {
->getUnder() ||
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
}
}
#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
}
}
#else
}
#endif
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) {
}
}
}
}
//------------------------------------------------------------------------
// path segment operators
//------------------------------------------------------------------------
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
}
//------------------------------------------------------------------------
// path painting operators
//------------------------------------------------------------------------
{
doEndPath();
}
{
//error(getPos(), const_cast<char*>("No path in stroke"));
return;
}
} else {
}
}
doEndPath();
}
return;
}
} else {
}
}
doEndPath();
}
{
//error(getPos(), const_cast<char*>("No path in fill"));
return;
}
} else {
}
}
doEndPath();
}
{
//error(getPos(), const_cast<char*>("No path in eofill"));
return;
}
} else {
}
}
doEndPath();
}
{
return;
}
} else {
}
doEndPath();
}
{
return;
}
}
doEndPath();
}
{
return;
}
}
doEndPath();
}
{
return;
}
}
doEndPath();
}
}
}
} else {
}
}
return;
}
case 1:
break;
case 2:
break;
default:
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
break;
}
}
void PdfParser::doPatternStrokeFallback() {
return;
}
case 1:
break;
case 2:
break;
default:
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
break;
}
}
double det;
// save current graphics state
saveState();
// clip to bbox
if (0 ){//shading->getHasBBox()) {
//builder->clip(state);
}
// clip to current path
if (stroke) {
//out->clipToStrokePath(state);
} else {
if (eoFill) {
} else {
}
}
// set the color space
// background color fill
if (shading->getHasBackground()) {
}
// construct a (pattern space) -> (current space) transform matrix
btm = baseMatrix;
// iCTM = invert CTM
// m1 = PTM * BTM = PTM * base transform matrix
// m = m1 * iCTM = (PTM * BTM) * (iCTM)
// set the new matrix
// do shading type-specific operations
case 1:
break;
case 2:
case 3:
// no need to implement these
break;
case 4:
case 5:
break;
case 6:
case 7:
break;
}
// restore graphics state
restoreState();
}
// TODO not good that numArgs is ignored but args[] is used:
{
GfxShading *shading = 0;
double gradientTransform[6];
#if defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
return;
}
return;
}
#else
return;
}
#endif
// save current graphics state
saveState();
savedState = gTrue;
} else { // get gradient transform if possible
// check proper operator sequence
// first there should be one W(*) and then one 'cm' somewhere before 'sh'
seenConcat = gFalse;
int i = 1;
while (i <= maxOperatorHistoryDepth) {
const char *opName = getPreviousOperator(i);
if (seenConcat) { // more than one 'cm'
break;
} else {
seenConcat = gTrue;
}
}
i++;
}
if (seenConcat && seenClip) {
matrix = (double*)&gradientTransform;
}
}
}
// clip to bbox
if (shading->getHasBBox()) {
}
else {
}
if (savedState)
else
}
// set the color space
if (savedState)
// do shading type-specific operations
case 1:
break;
case 2:
case 3:
if (clipHistory->getClipPath()) {
}
break;
case 4:
case 5:
break;
case 6:
case 7:
break;
}
// restore graphics state
if (savedState) {
restoreState();
}
delete shading;
}
}
double *matrix;
int nComps, i, j;
// compare the four corner colors
for (i = 0; i < 4; ++i) {
for (j = 0; j < nComps; ++j) {
break;
}
}
if (j < nComps) {
break;
}
}
// center of the rectangle
// the four corner colors are close (or we hit the recursive limit)
// -- fill the rectangle; but require at least one subdivision
// (depth==0) to avoid problems when the four outer corners of the
// shaded region are the same color
// use the center color
// fill the rectangle
// the four corner colors are not close enough -- subdivide the
// rectangle
} else {
// colors[0] colorM0 colors[2]
// (x0,y0) (xM,y0) (x1,y0)
// +----------+----------+
// | | |
// | UL | UR |
// color0M | colorMM | color1M
// (x0,yM) +----------+----------+ (x1,yM)
// | (xM,yM) |
// | LL | LR |
// | | |
// +----------+----------+
// colors[1] colorM1 colors[3]
// (x0,y1) (xM,y1) (x1,y1)
// upper-left sub-rectangle
// lower-left sub-rectangle
// upper-right sub-rectangle
// lower-right sub-rectangle
}
}
int i;
for (i = 0; i < shading->getNTriangles(); ++i) {
}
}
int i;
for (i = 0; i < nComps; ++i) {
break;
}
}
} else {
//~ if the shading has a Function, this should interpolate on the
//~ function parameter, not on the color components
for (i = 0; i < nComps; ++i) {
}
}
}
int start, i;
start = 3;
start = 2;
start = 1;
} else {
start = 0;
}
for (i = 0; i < shading->getNPatches(); ++i) {
start);
}
}
#ifdef POPPLER_NEW_GFXPATCH
#endif
double xxm;
double yym;
int i;
for (i = 0; i < nComps; ++i) {
> patchColorDelta ||
> patchColorDelta ||
> patchColorDelta ||
> patchColorDelta) {
break;
}
#ifdef POPPLER_NEW_GFXPATCH
#endif
}
#ifdef POPPLER_NEW_GFXPATCH
#else
#endif
} else {
for (i = 0; i < 4; ++i) {
}
for (i = 0; i < 4; ++i) {
}
for (i = 4; i < 8; ++i) {
}
//~ if the shading has a Function, this should interpolate on the
//~ function parameter, not on the color components
for (i = 0; i < nComps; ++i) {
}
}
}
if (clip == clipNormal) {
} else {
}
}
}
//------------------------------------------------------------------------
// path clipping operators
//------------------------------------------------------------------------
{
clip = clipNormal;
}
{
}
//------------------------------------------------------------------------
// text object operators
//------------------------------------------------------------------------
{
state->textMoveTo(0, 0);
fontChanged = gTrue;
}
{
}
//------------------------------------------------------------------------
// text state operators
//------------------------------------------------------------------------
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
if (!font) {
// unsetting the font (drawing no text) is better than using the
// previous one and drawing random glyphs from it
fontChanged = gTrue;
return;
}
if (printCommands) {
printf(" font: tag=%s name='%s' %g\n",
}
fontChanged = gTrue;
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
fontChanged = gTrue;
}
//------------------------------------------------------------------------
// text positioning operators
//------------------------------------------------------------------------
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
}
// TODO not good that numArgs is ignored but args[] is used:
{
state->textMoveTo(0, 0);
fontChanged = gTrue;
}
{
}
//------------------------------------------------------------------------
// text string operators
//------------------------------------------------------------------------
// TODO not good that numArgs is ignored but args[] is used:
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
if (fontChanged) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
double tx = 0;
double ty = 0;
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
if (fontChanged) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
double tx = 0;
double ty = 0;
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
if (fontChanged) {
}
}
// TODO not good that numArgs is ignored but args[] is used:
{
Array *a = 0;
int wMode = 0;
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
if (fontChanged) {
}
for (int i = 0; i < a->getLength(); ++i) {
// this uses the absolute value of the font size to match
// Acrobat's behavior
if (wMode) {
} else {
}
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
}
}
/*
* The `POPPLER_NEW_GFXFONT' stuff is for the change to GfxFont's getNextChar() call.
* Thanks to tsdgeos for the fix.
* Miklos, does this look ok?
*/
int wMode;
#ifdef POPPLER_NEW_GFXFONT
#else
Unicode u[8];
#endif
double *mat;
char *p;
// handle a Type 3 char
for (int i = 0; i < 6; ++i) {
}
p = s->getCString();
while (len > 0) {
#ifdef POPPLER_NEW_GFXFONT
&u, &uLen, /* TODO: This looks like a memory leak for u. */
#else
#endif
if (n == 1 && *p == ' ') {
}
saveState();
//~ the CTM concat values here are wrong (but never used)
//out->updateCTM(state, 1, 0, 0, 1, 0, 0);
if (0){ /*!out->beginType3Char(state, curX + riseX, curY + riseY, tdx, tdy,
code, u, uLen)) {*/
}
//parse(&charProc, gFalse); // TODO: parse into SVG font
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
//out->endType3Char(state);
if (resDict) {
popResources();
}
}
restoreState();
// GfxState::restore() does *not* restore the current position,
// so we deal with it here using (curX, curY) and (lineX, lineY)
p += n;
len -= n;
}
} else {
p = s->getCString();
while (len > 0) {
#ifdef POPPLER_NEW_GFXFONT
&u, &uLen, /* TODO: This looks like a memory leak for u. */
#else
#endif
if (wMode) {
if (n == 1 && *p == ' ') {
}
} else {
if (n == 1 && *p == ' ') {
}
}
p += n;
len -= n;
}
}
}
//------------------------------------------------------------------------
// XObject operators
//------------------------------------------------------------------------
// TODO not good that numArgs is ignored but args[] is used:
{
return;
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
/* out->psXObject(obj1.getStream(),
obj3.isStream() ? obj3.getStream() : (Stream *)NULL);*/
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
} else {
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
}
{
int bits;
// get info from the stream
bits = 0;
// get stream dict
// get size
}
}
}
else {
goto err2;
}
}
}
}
else {
goto err2;
}
// image or mask?
}
}
goto err2;
}
// bit depth
if (bits == 0) {
}
} else if (mask) {
bits = 1;
} else {
goto err2;
}
}
// display a mask
if (mask) {
// check for inverted mask
if (bits != 1) {
goto err1;
}
}
}
goto err2;
}
// draw it
} else {
// get color space and color map
}
} else {
}
}
#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
#else
#endif
} else if (csMode == streamCSDeviceGray) {
colorSpace = new GfxDeviceGrayColorSpace();
} else if (csMode == streamCSDeviceRGB) {
colorSpace = new GfxDeviceRGBColorSpace();
} else if (csMode == streamCSDeviceCMYK) {
colorSpace = new GfxDeviceCMYKColorSpace();
} else {
colorSpace = NULL;
}
if (!colorSpace) {
goto err1;
}
}
delete colorMap;
goto err1;
}
// get the mask
int maskWidth = 0;
int maskHeight = 0;
maskInvert = gFalse;
// soft mask
if (inlineImg) {
goto err1;
}
}
goto err2;
}
}
goto err2;
}
}
goto err2;
}
}
} else {
}
}
#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
#else
#endif
goto err1;
}
}
if (!maskColorMap->isOk()) {
delete maskColorMap;
goto err1;
}
//~ handle the Matte entry
// color key mask
int i;
}
// explicit mask
if (inlineImg) {
goto err1;
}
}
goto err2;
}
}
goto err2;
}
}
goto err2;
}
maskInvert = gFalse;
}
maskInvert = gTrue;
}
goto err2;
}
}
// draw it
if (haveSoftMask) {
delete maskColorMap;
} else if (haveExplicitMask) {
} else {
}
delete colorMap;
}
return;
err2:
err1:
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
int i;
// check for excessive recursion
if (formDepth > 20) {
return;
}
// get stream dict
// check form type
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
// get bounding box
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return;
}
for (i = 0; i < 4; ++i) {
}
// get matrix
for (i = 0; i < 6; ++i) {
}
} else {
m[0] = 1; m[1] = 0;
m[2] = 0; m[3] = 1;
m[4] = 0; m[5] = 0;
}
// get resources
// check for a transparency group
transpGroup = gTrue;
#if defined(POPPLER_EVEN_NEWER_NEW_COLOR_SPACE_API)
#elif defined(POPPLER_EVEN_NEWER_COLOR_SPACE_API)
#else
#endif
}
}
}
}
}
// draw it
++formDepth;
--formDepth;
if (blendingColorSpace) {
delete blendingColorSpace;
}
}
double oldBaseMatrix[6];
int i;
// push new resources on stack
// save current graphics state
saveState();
// kill any pre-existing path
if (softMask || transpGroup) {
}
// save current parser
// set form transformation matrix
// set form bounding box
if (softMask || transpGroup) {
}
}
}
}
// set new base matrix
for (i = 0; i < 6; ++i) {
oldBaseMatrix[i] = baseMatrix[i];
}
// draw the form
// restore base matrix
for (i = 0; i < 6; ++i) {
baseMatrix[i] = oldBaseMatrix[i];
}
// restore parser
if (softMask || transpGroup) {
}
// restore graphics state
restoreState();
// pop resource stack
popResources();
if (softMask) {
} else if (transpGroup) {
}
return;
}
//------------------------------------------------------------------------
// in-line image operators
//------------------------------------------------------------------------
{
// display the image
if (str) {
// skip 'EI' tag
}
delete str;
}
}
char *key;
// build dictionary
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
} else {
break;
}
}
}
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
return NULL;
}
// make stream
return str;
}
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
{
#ifdef POPPLER_NEW_ERRORAPI
#else
#endif
}
//------------------------------------------------------------------------
// type 3 font operators
//------------------------------------------------------------------------
{
}
{
}
//------------------------------------------------------------------------
// compatibility operators
//------------------------------------------------------------------------
{
++ignoreUndef;
}
{
if (ignoreUndef > 0)
--ignoreUndef;
}
//------------------------------------------------------------------------
// marked content operators
//------------------------------------------------------------------------
if (printCommands) {
if (numArgs == 2)
printf("\n");
}
if(numArgs == 2) {
//out->beginMarkedContent(args[0].getName(),args[1].getDict());
} else {
//out->beginMarkedContent(args[0].getName());
}
}
{
//out->endMarkedContent();
}
if (printCommands) {
if (numArgs == 2)
printf("\n");
}
if(numArgs == 2) {
//out->markPoint(args[0].getName(),args[1].getDict());
} else {
//out->markPoint(args[0].getName());
}
}
//------------------------------------------------------------------------
// misc
//------------------------------------------------------------------------
bool is_radial = false;
is_radial = true;
}
if (is_radial)
state->save(); // nasty hack to prevent GfxRadialShading from getting corrupted during copy operation
else
}
void PdfParser::restoreState() {
builder->restoreState();
}
}
void PdfParser::popResources() {
delete res;
}
void PdfParser::setDefaultApproximationPrecision() {
for (int i = 1; i <= pdfNumShadingTypes; ++i) {
}
}
int maxDepth) {
return;
}
}
//------------------------------------------------------------------------
// ClipHistoryEntry
//------------------------------------------------------------------------
{
}
{
if (clipPath) {
delete clipPath;
}
}
// Free previous clip path
if (clipPath) {
delete clipPath;
}
if (clipPathA) {
} else {
}
}
return newEntry;
}
if (saved) {
delete this; // TODO really should avoid deleting from inside.
} else {
oldEntry = this;
}
return oldEntry;
}
} else {
this->clipType = clipNormal;
}
}
#endif /* HAVE_POPPLER */