Back to index

tetex-bin  3.0
Defines | Typedefs | Functions | Variables
epdf.h File Reference
#include <kpathsea/c-auto.h>
#include <kpathsea/c-proto.h>
#include <web2c/c-auto.h>
#include <web2c/config.h>
#include <web2c/pdftexdir/ptexmac.h>
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define KPATHSEA_CONFIG_H   /* avoid including other kpathsea header files */
#define pdfbufsize   pdfbufmax

Typedefs

typedef const char * const_string
typedef unsigned char eightbits

Functions

int is_subsetable (struct fm_entry *)
int is_type1 (struct fm_entry *)
struct fm_entrylookup_fontmap (char *)
integer get_fontfile (struct fm_entry *)
integer get_fontname (struct fm_entry *)
integer pdfnewobjnum (void)
integer read_pdf_info (char *, char *, integer, integer, integer, integer)
void embed_whole_font (struct fm_entry *)
void epdf_check_mem (void)
void epdf_delete (void)
void epdf_free (void)
void mark_glyphs (struct fm_entry *, char *)
void pdf_printf (const char *fmt,...)
void pdf_puts (const char *)
void pdfbeginstream (void)
void pdfendobj (void)
void pdfendstream (void)
void pdfflush (void)
void pdftex_fail (const char *fmt,...)
void pdftex_warn (const char *fmt,...)
void tex_printf (const char *,...)
void write_enc (char **, struct enc_entry *, integer)
void write_epdf (void)
void zpdfbegindict (integer)
void zpdfbeginobj (integer)
void zpdfcreateobj (integer, integer)
void zpdfnewdict (integer, integer)
char * convertStringToPDFString (char *in)
integer cfgpar (integer)
void avl_put_obj (integer, integer)
integer avl_find_obj (integer, integer, integer)

Variables

float epdf_width
float epdf_height
float epdf_orig_x
float epdf_orig_y
integer epdf_selected_page
integer epdf_num_pages
integer epdf_page_box
integer epdf_always_use_pdf_pagebox
voidepdf_doc
voidepdf_xref
integer pdfstreamlength
integer pdfptr
eightbits pdfbuf []
integer pdfbufmax
char notdef []

Define Documentation

#define KPATHSEA_CONFIG_H   /* avoid including other kpathsea header files */

Definition at line 33 of file epdf.h.

#define pdfbufsize   pdfbufmax

Definition at line 45 of file epdf.h.


Typedef Documentation

typedef const char* const_string

Definition at line 31 of file epdf.h.

typedef unsigned char eightbits

Definition at line 60 of file epdf.h.


Function Documentation

char* convertStringToPDFString ( char *  in)

Definition at line 393 of file utils.c.

{
    static char pstrbuf[MAX_PSTRING_LEN];
    char *out = pstrbuf;
    int lin = strlen (in);
    int i, j;
    char buf[4];
    j = 0;
    for (i = 0; i < lin; i++) {
        check_buf(j + sizeof(buf), MAX_PSTRING_LEN);
        if ((unsigned char)in[i] < ' ') {
            /* convert control characters into hex */
            sprintf (buf, "#%02x", (unsigned int)(unsigned char)in[i]);
            out[j++] = buf[0];
            out[j++] = buf[1];
            out[j++] = buf[2];
            }
        else if ((in[i] == '(') || (in[i] == ')')) {
            /* escape paranthesis */
            out[j++] = '\\';
            out[j++] = in[i];
            }
        else if (in[i] == '\\') {
            /* escape backslash */
            out[j++] = '\\';
            out[j++] = '\\';
            }
        else {
            /* copy char :-) */
            out[j++] = in[i];
            }
        }
    out[j] = '\0';
    return pstrbuf;
}

Here is the caller graph for this function:

void embed_whole_font ( struct fm_entry )

Definition at line 57 of file epdf.c.

{
    fm->all_glyphs = true;
}

Here is the caller graph for this function:

Definition at line 1061 of file pdftoepdf.cc.

{
    if (isInit) {
        PdfDocument *p, *n;
    for (p = pdfDocuments; p; p = n) {
        n = p->next;
        delete_document(p);
    }
    // see above for globalParams
    delete globalParams;
    }
}

Here is the call graph for this function:

Definition at line 1047 of file pdftoepdf.cc.

{
    PdfDocument *pdf_doc = (PdfDocument *) epdf_doc;
    xref = pdf_doc->xref;
    if (pdf_doc->occurences < 0) {
#ifdef DEBUG
        fprintf(stderr, "\nDeleting %s\n", pdf_doc->file_name);
#endif
        delete_document(pdf_doc);
    }
}

Here is the caller graph for this function:

Definition at line 74 of file epdf.c.

integer get_fontfile ( struct fm_entry )

Definition at line 62 of file epdf.c.

{
    return fm->ff_objnum;
}

Here is the caller graph for this function:

integer get_fontname ( struct fm_entry )

Definition at line 67 of file epdf.c.

{
    if (fm->fn_objnum == 0)
        fm->fn_objnum = pdfnewobjnum();
    return fm->fn_objnum;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int is_subsetable ( struct fm_entry )

Definition at line 31 of file epdf.c.

{
    return is_included(fm) && is_subsetted(fm);
}

Here is the caller graph for this function:

int is_type1 ( struct fm_entry )

Definition at line 36 of file epdf.c.

{
    return is_t1fontfile(fm);
}

Here is the caller graph for this function:

struct fm_entry* lookup_fontmap ( char *  ) [read]

Definition at line 824 of file mapfile.c.

{
    fm_entry *fm, *fmx;
    fm_entry tmp, tmpx;
    ff_entry *ff;
    char buf[SMALL_BUF_SIZE];
    char *a, *b, *c, *d, *e, *s;
    strnumber str;
    int i, sl, ex, ai;
    if (tfm_tree == NULL || mapitems != NULL)
        fm_read_info();
    if (bname == NULL)
        return dummy_fm_entry();
    if (strlen(bname) >= SMALL_BUF_SIZE)
        pdftex_fail("Font name too long: `%s'", bname);
    strcpy(buf, bname);         /* keep bname untouched for later */
    s = buf; 
    if (strlen(buf) > 7) {        /* check for subsetted name tag */
        for (i = 0; i < 6; i++, s++)
            if (*s < 'A' || *s > 'Z')
                break;
        if (i == 6 && *s == '+')
            s++;                /* if name tag found, skip behind it */
        else
            s = buf;
    }

    /*
       Scan -Slant_<slant> and -Extend_<extend> font name extensions;
       three valid formats:
       <fontname>-Slant_<slant>
       <fontname>-Slant_<slant>-Extend_<extend>
       <fontname>-Extend_<extend>
       Slant entry must come _before_ Extend entry
     */

    tmp.slant = 0;
    tmp.extend = 0;
    if ((a = strstr(s, "-Slant_")) != NULL) {
        b = a + strlen("-Slant_");
        sl = (int) strtol(b, &e, 10);
        if ((e != b) && (e == strend(b))) {
            tmp.slant = sl;
            *a = 0;                /* bname string ends before "-Slant_" */
        } else {
            if (e != b) {        /* only if <slant> is valid number */
                if ((c = strstr(e, "-Extend_")) != NULL) {
                    d = c + strlen("-Extend_");
                    ex = (int) strtol(d, &e, 10);
                    if ((e != d) && (e == strend(d))) {
                        tmp.slant = sl;
                        tmp.extend = ex;
                        *a = 0;        /* bname string ends before "-Slant_" */
                    }
                }
            }
        }
    } else {
        if ((a = strstr(s, "-Extend_")) != NULL) {
            b = a + strlen("-Extend_");
            ex = (int) strtol(b, &e, 10);
            if ((e != b) && (e == strend(b))) {
                tmp.extend = ex;
                *a = 0;                /* bname string ends before "-Extend_" */
            }
        }
    }
    tmp.ps_name = s;
    tmp.tfm_name = NULL;
    fm = lookup_ps_name(&tmp);
    if (fm != NULL) {
        i = fm->tfm_num;
        assert(i != getnullfont());
        if (pdffontmap[i] == NULL)
            pdffontmap[i] = (fmentryptr) fm;
        if (fm->ff_objnum == 0 && is_included(fm))
            fm->ff_objnum = pdfnewobjnum();
        if (!fontused[i])
            pdfinitfont(i);
        return fm;
    }
/*
   The following code snipplet handles fonts with "Slant" and "Extend"
   name extensions in embedded PDF files, which don't yet have an
   fm_entry. If such a font is found (e. g. CMR10-Extend_1020), and no
   fm_entry for this is found in the ps_tree (e. g. ps_name = "CMR10",
   extend = 1020), and if an unextended base font (e. g. CMR10) is found,
   a new <nontfm> fm_entry is created and put into the ps_tree. Then
   the lookup_fontmap() function is (recursively) called again, which
   then should find the new fm_entry. The same can be done manually by
   a map entry e. g.:

   \pdfmapline{+<nontfm> CMR10 "1.02 ExtendFont" <cmr10.pfb}

   This would also match the embedded font CMR10-Extend_1020, and replace
   it by an extended copy of cmr10.pfb. -- But not by an expanded version;
   no MM files (e.g. cmr10+20.pfb) would be used.
*/

    tmpx.ps_name = s;
    tmpx.tfm_name = NULL;
    tmpx.slant = 0;
    tmpx.extend = 0;
/*     fm = (fm_entry *) avl_find(ps_tree, &tmpx); */
    fm = lookup_ps_name(&tmpx);
    if (fm != NULL) {
        if (is_truetype(fm) || !is_included(fm))
            return dummy_fm_entry();
        ff = check_ff_exist(fm);
        if (ff->ff_path == NULL)
            return dummy_fm_entry();
        fmx = new_fm_entry();
        fmx->flags = fm->flags;
        fmx->encoding = fm->encoding;
        fmx->type = fm->type;
        fmx->slant = tmp.slant;
        fmx->extend = tmp.extend;
        fmx->tfm_name = xstrdup(nontfm);
        fmx->ps_name = xstrdup(s);
        fmx->ff_name = xstrdup(fm->ff_name);
        ai = avl_do_entry(fmx, FM_DUPIGNORE);
        assert(ai == 0);
        fm = lookup_fontmap(bname);        /* new try */
        assert(fm != NULL);
        return fm;
    }
    return dummy_fm_entry();
}

Here is the caller graph for this function:

void mark_glyphs ( struct fm_entry ,
char *   
)

Definition at line 41 of file epdf.c.

{
    char *new_charset = fm->charset;
    if (charset == NULL)
        return;
    if (new_charset == NULL)
        new_charset = xstrdup(charset);
    else {
        new_charset = xretalloc(new_charset, 
                                strlen(new_charset) + strlen(charset) + 1,
                                char);
        strcat(new_charset, charset);
    }
    fm->charset = new_charset;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void pdf_printf ( const char *  fmt,
  ... 
)

Definition at line 150 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    vsprintf(print_buf, fmt, args);
    pdf_puts(print_buf);                                    
    va_end(args);
}

Here is the caller graph for this function:

void pdf_puts ( const char *  )

Definition at line 143 of file utils.c.

{
    pdfroom(strlen(s) + 1);
    while (*s)
        pdfbuf[pdfptr++] = *s++;
}

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

void pdftex_fail ( const char *  fmt,
  ... 
)

Definition at line 195 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    println();
    safe_print("Error: ");
    safe_print(program_invocation_name);
    if (cur_file_name) {
        safe_print(" (file ");
        safe_print(cur_file_name);
        safe_print(")");
    }
    safe_print(": ");
    vsprintf(print_buf, fmt, args);
    safe_print(print_buf);
    va_end(args);
    println();
    safe_print(" ==> Fatal error occurred, the output PDF file is not finished!");
    println();
    exit(-1);
}
void pdftex_warn ( const char *  fmt,
  ... 
)

Definition at line 217 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    println();
    tex_printf("Warning: %s", program_invocation_name);
    if (cur_file_name)
        tex_printf(" (file %s)", cur_file_name);
    tex_printf(": ");
    vsprintf(print_buf, fmt, args);
    print(maketexstring(print_buf));
    flushstr(last_tex_string);
    va_end(args);
    println();
}
integer read_pdf_info ( char *  ,
char *  ,
integer  ,
integer  ,
integer  ,
integer   
)

Definition at line 678 of file pdftoepdf.cc.

{
    PdfDocument *pdf_doc;
    Page *page;
    int rotate;
    PDFRectangle *pagebox;
    float pdf_version_found, pdf_version_wanted;
    // initialize
    if (!isInit) {
        globalParams = new GlobalParams();
        globalParams->setErrQuiet(gFalse);
        isInit = gTrue;
    }
    // open PDF file
    pdf_doc = find_add_document(image_name);
    epdf_doc = (void *) pdf_doc;
#ifdef DEBUG
    fprintf(stderr, "\nReading information on %s\n", pdf_doc->file_name);
#endif
    // check pdf version
    // this works only for pdf 1.x -- but since any versions of pdf newer
    // than 1.x will not be backwards compatible to pdf 1.x, pdfTeX will
    // then have to changed drastically anyway.
    pdf_version_found = pdf_doc->doc->getPDFVersion();
    pdf_version_wanted = 1 + (minor_pdf_version_wanted * 0.1);
    if (pdf_version_found > pdf_version_wanted) {
        char msg[] = "pdf inclusion: found pdf version <%.1f>, but at most version <%.1f> allowed";
        if (pdf_inclusion_errorlevel > 0) {
            pdftex_fail(msg, pdf_version_found, pdf_version_wanted);
        } else {
            pdftex_warn(msg, pdf_version_found, pdf_version_wanted);
        }
    }
    epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
    if (page_name) {
        // get page by name
        GString name(page_name);
        LinkDest *link = pdf_doc->doc->findDest(&name);
        if (link == 0 || !link->isOk())
            pdftex_fail("pdf inclusion: invalid destination <%s>",
                page_name);
        Ref ref = link->getPageRef();
        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
        if (page_num == 0)
            pdftex_fail("pdf inclusion: destination is not a page <%s>",
                page_name);
        delete link;
    } else {
        // get page by number
        if (page_num <= 0 || page_num > epdf_num_pages)
        pdftex_fail("pdf inclusion: required page does not exist <%i>", 
            epdf_num_pages);
    }
    // get the required page
    page = pdf_doc->doc->getCatalog()->getPage(page_num);

    // get the pagebox (media, crop...) to use.
    // always_use_pdf_pagebox can set in the config file to override the
    // setting through pdfximage.
    if (always_use_pdf_pagebox < 1) {
        switch (pdflastpdfboxspec) {
        case pdfpdfboxspeccrop:
            pagebox = page->getCropBox();
            break;
        
        case pdfpdfboxspecbleed:
            pagebox = page->getBleedBox();
            break;
        
        case pdfpdfboxspectrim:
            pagebox = page->getTrimBox();
            break;
        
        case pdfpdfboxspecart:
            pagebox = page->getArtBox();
            break;

        default:
            pagebox = page->getMediaBox();
            }
        }
    else {
        switch (always_use_pdf_pagebox) {
        case 1 : 
            pagebox = page->getMediaBox();
            break;
        case 2 : 
            pagebox = page->getCropBox();
            break;
        case 3 : 
            pagebox = page->getBleedBox();
            break;
        case 4 : 
            pagebox = page->getTrimBox();
            break;
        default : // 5 and larger
            pagebox = page->getArtBox();
            }
        }
#ifdef DEBUG
    fprintf(stderr, 
            "\npagebox->x1: %.8f, pagebox->x2: %.8f, pagebox->y1: %.8f, pagebox->y2: %.8f\n", 
            pagebox->x1, pagebox->x2, pagebox->y1, pagebox->y2);
#endif
    epdf_width = pagebox->x2 - pagebox->x1;
    epdf_height = pagebox->y2 - pagebox->y1;
    epdf_orig_x = pagebox->x1;
    epdf_orig_y = pagebox->y1;
    
    rotate = page->getRotate();
    // handle page rotation and adjust dimens as needed
    if (rotate != 0) {
        if (rotate % 90 == 0) {
            // handle only the simple case: multiple of 90s.
            // these are the only values allowed according to the
            // reference (v1.3, p.78).
            // 180 needs no special treatment here
            register float f;
            switch (rotate) {
                case  90: f = epdf_height; epdf_height = epdf_width; epdf_width = f;  break;
                case 270: f = epdf_height; epdf_height = epdf_width; epdf_width = f;  break;
                }
            }
        }
    pdf_doc->xref = pdf_doc->doc->getXRef();
    return page_num;
}

Here is the caller graph for this function:

void tex_printf ( const char *  ,
  ... 
)

Definition at line 172 of file utils.c.

{
    va_list args;
    va_start(args, fmt);
    vsprintf(print_buf, fmt, args);
    print(maketexstring(print_buf));
    flushstr(last_tex_string);
    xfflush(stdout);
    va_end(args);
}

Here is the caller graph for this function:

void write_enc ( char **  ,
struct enc_entry ,
integer   
)

Definition at line 43 of file writeenc.c.

{
    boolean is_notdef;
    int i;
    char **g;
    if (glyph_names == NULL) {
        assert(e != NULL);
        if (e->objnum != 0) /* the encoding has been written already */
            return;
        pdfnewdict(0, 0);
        e->objnum = objptr;
        g = e->glyph_names;
    }
    else {
        pdfbegindict(eobjnum);
        g = glyph_names;
    }
    pdf_printf("/Type /Encoding\n/Differences [ 0 /%s", g[0]);
    is_notdef = (g[0] == notdef);
    for (i = 1; i <= MAX_CHAR_CODE; i++) {
        if (g[i] == notdef) {
            if (!is_notdef) {
                pdf_printf(" %i/%s", i, notdef);
                is_notdef = true;
            }
        }
        else {
            if (is_notdef) {
                pdf_printf(" %i", i);
                is_notdef = false;
            }
            pdf_printf("/%s", g[i]);
        }
    }
    pdf_puts("]\n");
    pdfenddict();
}

Here is the caller graph for this function:

Definition at line 813 of file pdftoepdf.cc.

{
    Page *page;
    PdfObject contents, obj1, obj2;
    PdfObject group, metadata, pieceinfo, separationInfo;
    Object info;
    char *key;
    int i, l;
    int rotate;
    double scale[6] = {0, 0, 0, 0, 0, 0};
    PdfDocument *pdf_doc = (PdfDocument *) epdf_doc;
    (pdf_doc->occurences)--;
#ifdef DEBUG
    fprintf(stderr, "\nDecrementing %s (%d)\n", pdf_doc->file_name, pdf_doc->occurences);
#endif
    xref = pdf_doc->xref;
    inObjList = pdf_doc->inObjList;
    encodingList = 0;
    page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
    rotate = page->getRotate();
    PDFRectangle *pagebox;
    // write the Page header
    pdf_puts("/Type /XObject\n");
    pdf_puts("/Subtype /Form\n");
    pdf_puts("/FormType 1\n");

    // write additional information
    pdf_printf("/%s.FileName (%s)\n", pdfkeyprefix, 
               convertStringToPDFString(pdf_doc->file_name));
    pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, epdf_selected_page);
    pdf_doc->doc->getDocInfoNF(&info);
    if (info.isRef()) {
        // the info dict must be indirect (pdf ref p.61)
        pdf_printf("/%s.InfoDict ", pdfkeyprefix);
        pdf_printf("%d 0 R \n", addOther(info.getRef()));
        }
  
    // get the pagebox (media, crop...) to use.
    // epdf_always_use_pdf_pagebox is a copy of always_use_pdf_pagebox which
    // can set in the config file to override the setting through pdfximage.
    if (epdf_always_use_pdf_pagebox < 1) {
        switch (epdf_page_box) {
        case pdfpdfboxspeccrop:
            pagebox = page->getCropBox();
            break;
      
        case pdfpdfboxspecbleed:
            pagebox = page->getBleedBox();
            break;
        
        case pdfpdfboxspectrim:
            pagebox = page->getTrimBox();
            break;
        
        case pdfpdfboxspecart:
            pagebox = page->getArtBox();
            break;
       
        default:
            pagebox = page->getMediaBox();
            }
        }
    else {
        switch (epdf_always_use_pdf_pagebox) {
        case 1 : 
            pagebox = page->getMediaBox();
            break;
        case 2 : 
            pagebox = page->getCropBox();
            break;
        case 3 : 
            pagebox = page->getBleedBox();
            break;
        case 4 : 
            pagebox = page->getTrimBox();
            break;
        default : // 5 and larger
            pagebox = page->getArtBox();
            }
        }
#ifdef DEBUG
    fprintf(stderr, 
            "\npagebox->x1: %.8f, pagebox->x2: %.8f, pagebox->y1: %.8f, pagebox->y2: %.8f\n", 
            pagebox->x1, pagebox->x2, pagebox->y1, pagebox->y2);
#endif

    // handle page rotation
    if (rotate != 0) {
        if (rotate % 90 == 0) {
            // this handles only the simple case: multiple of 90s but these
            // are the only values allowed according to the reference
            // (v1.3, p.78).
            // the image is rotated around its center.
            // the /Rotate key is clockwise while the matrix is
            // counterclockwise :-%
            tex_printf (", page is rotated %d degrees", rotate);
            switch (rotate) {
                case  90: scale[1] = -1; scale[2] = 1; scale[4] = pagebox->x1 - pagebox->y1; scale[5] = pagebox->y1 + pagebox->x2; break;
                case 180: scale[0] = scale[3] = -1;    scale[4] = pagebox->x1 + pagebox->x2; scale[5] = pagebox->y1 + pagebox->y2; break; // width and height are exchanged
                case 270: scale[1] = 1; scale[2] = -1; scale[4] = pagebox->x1 + pagebox->y2; scale[5] = pagebox->y1 - pagebox->x1; break;
                }
            }
        }
    else {
        scale[0] = scale[3] = 1;
        }

    pdf_printf("/Matrix [%.8f %.8f %.8f %.8f %.8f %.8f]\n",
        scale[0],
        scale[1],
        scale[2],
        scale[3],
        scale[4],
        scale[5]);

    pdf_printf("/BBox [%.8f %.8f %.8f %.8f]\n",
               pagebox->x1,
               pagebox->y1,
               pagebox->x2,
               pagebox->y2);

    // write the page Group if it's there
    if (page->getGroup() != NULL) {
#if PDFTEX_COPY_PAGEGROUP
#   if PDFTEX_COPY_PAGEGROUP_NOFAIL
        // FIXME: This will most likely produce incorrect PDFs :-(
        initDictFromDict(group, page->getGroup());
        if (group->dictGetLength() > 0) {
            pdf_puts("/Group ");
            copyObject (&group);
            pdf_puts("\n");
        }
#   else
        // FIXME: currently we don't know how to handle Page Groups so we abort gracefully :-(
        pdftex_fail("pdf inclusion: Page Group detected which pdfTeX can't handle. Sorry.");
#   endif
#else
        // FIXME: currently we don't know how to handle Page Groups so we at least give a warning :-(
        pdftex_warn("pdf inclusion: Page Group detected which pdfTeX can't handle. Ignoring it.");
#endif
    }
    
    // write the page Metadata if it's there
    if (page->getMetadata() != NULL) {
        metadata->initStream(page->getMetadata());
        pdf_puts("/Metadata ");
        copyObject (&metadata);
        pdf_puts("\n");
    }
    
    // write the page PieceInfo if it's there
    if (page->getPieceInfo() != NULL) {
        initDictFromDict (pieceinfo, page->getPieceInfo());
        if (pieceinfo->dictGetLength() > 0) {
            pdf_puts("/PieceInfo ");
            copyObject (&pieceinfo);
            pdf_puts("\n");
        }
    }
    
    // write the page SeparationInfo if it's there
    if (page->getSeparationInfo() != NULL) {
        initDictFromDict (separationInfo, page->getSeparationInfo());
        if (separationInfo->dictGetLength() > 0) {
            pdf_puts("/SeparationInfo ");
            copyObject (&separationInfo);
            pdf_puts("\n");
        }
    }
    
    // write the Resources dictionary
    if (page->getResourceDict() == NULL) {
        // Resources can be missing (files without them have been spotted
        // in the wild). This violates the pdf spec, which claims they are
        // required, but all RIPs accept them.  
        // We "replace" them with empty Resources.
        pdftex_warn("pdf inclusion: no /Resources detected. Replacing with empty /Resources.");
        pdf_puts("/Resources <<>>\n");
        }
    else {
        initDictFromDict (obj1, page->getResourceDict());
        page->getResourceDict()->incRef();
        if (!obj1->isDict())
            pdftex_fail("pdf inclusion: invalid resources dict type <%s>", 
                        obj1->getTypeName());
        pdf_puts("/Resources <<\n");
        for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
            obj1->dictGetVal(i, &obj2);
            key = obj1->dictGetKey(i);
            if (strcmp("Font", key) == 0)
                copyFontResources(&obj2);
            else if (strcmp("ProcSet", key) == 0)
                copyProcSet(&obj2);
            else
                copyOtherResources(&obj2, key);
            }
        pdf_puts(">>\n");
    }
    // write the page contents
    page->getContents(&contents);
    if (contents->isStream()) {
        initDictFromDict (obj1, contents->streamGetDict());
        contents->streamGetDict()->incRef();
        copyDict(&obj1);
        pdf_puts(">>\nstream\n");
        copyStream(contents->getStream()->getBaseStream());
        pdf_puts("endstream\n");
        pdfendobj();
    }
    else if (contents->isArray()) {
        pdfbeginstream();
        for (i = 0, l = contents->arrayGetLength(); i < l; ++i) {
        Object contentsobj;
            copyStream((contents->arrayGet(i, &contentsobj))->getStream());
        contentsobj.free();
        }
        pdfendstream();
    }
    else {// the contents are optional, but we need to include an empty stream
        pdfbeginstream();
        pdfendstream();
    }
    // write out all indirect objects
    writeRefs();
    // write out all used encodings (and delete list)
    writeEncodings();
    // save object list, xref
    pdf_doc->inObjList = inObjList;
    pdf_doc->xref = xref;
}

Here is the caller graph for this function:

Here is the caller graph for this function:


Variable Documentation

Definition at line 43 of file writeimg.c.

Definition at line 44 of file writeimg.c.

float epdf_height

Definition at line 37 of file writeimg.c.

Definition at line 41 of file writeimg.c.

float epdf_orig_x

Definition at line 38 of file writeimg.c.

float epdf_orig_y

Definition at line 39 of file writeimg.c.

Definition at line 42 of file writeimg.c.

Definition at line 40 of file writeimg.c.

float epdf_width

Definition at line 36 of file writeimg.c.

char notdef[]

Definition at line 179 of file t1part.c.

Definition at line 27 of file epdf.c.