예제 #1
0
파일: gdevpsim.c 프로젝트: 99years/plan9
/* Write the file (if necessary) and page headers. */
private void
ps_image_write_headers(FILE *f, gx_device_printer *pdev,
		       const char *const setup[],
		       gx_device_pswrite_common_t *pdpc)
{
    if (gdev_prn_file_is_new(pdev)) {
	gs_rect bbox;

	bbox.p.x = 0;
	bbox.p.y = 0;
	bbox.q.x = pdev->width / pdev->HWResolution[0] * 72.0;
	bbox.q.y = pdev->height / pdev->HWResolution[1] * 72.0;
	psw_begin_file_header(f, (gx_device *)pdev, &bbox, pdpc, false);
	psw_print_lines(f, setup);
	psw_end_file_header(f);
    }
    {
	byte buf[100];		/* arbitrary */
	stream s;

	s_init(&s, pdev->memory);
	swrite_file(&s, f, buf, sizeof(buf));
	psw_write_page_header(&s, (gx_device *)pdev, pdpc, true, pdev->PageCount + 1, 10);
	sflush(&s);
    }
}
예제 #2
0
int gdev_tiff_begin_page(gx_device_tiff *tfdev,
                         FILE *file)
{
    gx_device_printer *const pdev = (gx_device_printer *)tfdev;

    if (gdev_prn_file_is_new(pdev)) {
        /* open the TIFF device */
        tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
        if (!tfdev->tif)
            return_error(gs_error_invalidfileaccess);
    }

    return tiff_set_fields_for_printer(pdev, tfdev->tif, tfdev->DownScaleFactor,
                                       tfdev->AdjustWidth);
}
예제 #3
0
/* Begin a capi fax page. */
static int
cfax_begin_page(gx_device_printer * pdev, FILE * fp, int width)
{
    /* Patch the width to reflect fax page width adjustment. */
    int save_width = pdev->width;

    pdev->width = width;
    if (gdev_prn_file_is_new(pdev)) {
        cfax_doc_hdr(fp);
    }
    cfax_page_hdr(pdev, fp);

    pdev->width = save_width;
    return 0;
}
예제 #4
0
/* Begin a TIFF fax page. */
static int
tfax_begin_page(gx_device_tfax * tfdev, FILE * file)
{
    gx_device_printer *const pdev = (gx_device_printer *)tfdev;
    int code;

    /* open the TIFF device */
    if (gdev_prn_file_is_new(pdev)) {
        tfdev->tif = tiff_from_filep(pdev->dname, file, tfdev->BigEndian);
        if (!tfdev->tif)
            return_error(gs_error_invalidfileaccess);
    }

    code = tiff_set_fields_for_printer(pdev, tfdev->tif, 1, tfdev->AdjustWidth);
    return code;
}