+/* postscript exporter implementation */
+
+static void
+tiff_document_ps_export_begin (EvPSExporter *exporter, const char *filename,
+ int first_page, int last_page)
+{
+ TiffDocument *document = TIFF_DOCUMENT (exporter);
+
+ document->ps_export_file = g_fopen (filename, "w");
+ if (document->ps_export_file == NULL)
+ return;
+ document->ps_export_pages = 0;
+}
+
+static void
+tiff_document_ps_export_do_page (EvPSExporter *exporter, int page)
+{
+ TiffDocument *document = TIFF_DOCUMENT (exporter);
+
+ if (document->ps_export_file == NULL)
+ return;
+ if (TIFFSetDirectory (document->tiff, page) != 1)
+ return;
+ TIFF2PS (document->ps_export_file,
+ document->tiff,
+ 0, 0, 0, 0, 0,
+ &document->ps_export_pages);
+}
+
+static void
+tiff_document_ps_export_end (EvPSExporter *exporter)
+{
+ TiffDocument *document = TIFF_DOCUMENT (exporter);
+
+ if (document->ps_export_file == NULL)
+ return;
+ if (document->ps_export_pages)
+ TIFFPSTail (document->ps_export_file,
+ document->ps_export_pages);
+ fclose (document->ps_export_file);
+}
+
+static void
+tiff_document_document_ps_exporter_iface_init (EvPSExporterIface *iface)
+{
+ iface->begin = tiff_document_ps_export_begin;
+ iface->do_page = tiff_document_ps_export_do_page;
+ iface->end = tiff_document_ps_export_end;
+}