filename = dupstr("output.pdf");
for (p = sourceform; p; p = p->next) {
- if (p->type == para_Config && p->parent) {
+ if (p->type == para_Config) {
if (!ustricmp(p->keyword, L"pdf-filename")) {
sfree(filename);
filename = dupstr(adv(p->origkeyword));
olist.number = 1;
cat = new_object(&olist);
- outlines = new_object(&olist);
+ if (doc->n_outline_elements > 0)
+ outlines = new_object(&olist);
+ else
+ outlines = NULL;
pages = new_object(&olist);
resources = new_object(&olist);
* The catalogue just contains references to the outlines and
* pages objects.
*/
- objtext(cat, "<<\n/Type /Catalog\n/Outlines ");
- objref(cat, outlines);
+ objtext(cat, "<<\n/Type /Catalog");
+ if (outlines) {
+ objtext(cat, "\n/Outlines ");
+ objref(cat, outlines);
+ }
objtext(cat, "\n/Pages ");
objref(cat, pages);
- objtext(cat, "\n/PageMode /UseOutlines\n>>\n");
+ if (outlines)
+ objtext(cat, "\n/PageMode /UseOutlines");
+ objtext(cat, "\n>>\n");
/*
* Set up the resources dictionary, which mostly means
width = 0.0;
else
width = fe->font->widths[fe->indices[i]];
- sprintf(buf, "%g\n", 1000.0 * width / 4096.0);
+ sprintf(buf, "%g\n", 1000.0 * width / FUNITS_PER_PT);
objtext(widths, buf);
}
objtext(widths, "]\n");
* So we don't need a /Resources entry here.
*/
sprintf(buf, "/MediaBox [0 0 %g %g]\n",
- doc->paper_width / 4096.0, doc->paper_height / 4096.0);
+ doc->paper_width / FUNITS_PER_PT,
+ doc->paper_height / FUNITS_PER_PT);
objtext(opage, buf);
/*
*/
for (r = page->first_rect; r; r = r->next) {
char buf[512];
- sprintf(buf, "%g %g %g %g re f\n", r->x / 4096.0,
- r->y / 4096.0, r->w / 4096.0, r->h / 4096.0);
+ sprintf(buf, "%g %g %g %g re f\n",
+ r->x / FUNITS_PER_PT, r->y / FUNITS_PER_PT,
+ r->w / FUNITS_PER_PT, r->h / FUNITS_PER_PT);
objstream(cstr, buf);
}
*/
if (lx < 0) {
sprintf(buf, "1 0 0 1 %g %g Tm ",
- frag->x/4096.0, frag->y/4096.0);
+ frag->x/FUNITS_PER_PT, frag->y/FUNITS_PER_PT);
} else {
sprintf(buf, "%g %g Td ",
- (frag->x - lx)/4096.0, (frag->y - ly)/4096.0);
+ (frag->x - lx)/FUNITS_PER_PT,
+ (frag->y - ly)/FUNITS_PER_PT);
}
objstream(cstr, buf);
lx = x = frag->x;
if (frag->x != x) {
sprintf(buf, "%g",
(x - frag->x) * 1000.0 /
- (4096.0 * frag->fontsize));
+ (FUNITS_PER_PT * frag->fontsize));
objstream(cstr, buf);
}
pdf_string(objstream, cstr, frag->text);
objtext(annot, "<<\n/Type /Annot\n/Subtype /Link\n/Rect [");
sprintf(buf, "%g %g %g %g",
- xr->lx / 4096.0, xr->by / 4096.0,
- xr->rx / 4096.0, xr->ty / 4096.0);
+ xr->lx / FUNITS_PER_PT, xr->by / FUNITS_PER_PT,
+ xr->rx / FUNITS_PER_PT, xr->ty / FUNITS_PER_PT);
objtext(annot, buf);
objtext(annot, "]\n/Border [0 0 0]\n");
/*
* Set up the outlines dictionary.
*/
- {
+ if (outlines) {
int topcount;
char buf[80];
static object *new_object(objlist *list)
{
- object *obj = mknew(object);
+ object *obj = snew(object);
obj->list = list;