~ubuntu-branches/ubuntu/hardy/evince/hardy

« back to all changes in this revision

Viewing changes to backend/pdf/ev-poppler.cc

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2007-11-27 22:31:42 UTC
  • mfrom: (1.1.22 upstream)
  • Revision ID: james.westby@ubuntu.com-20071127223142-v41zyp2ulj6g22n6
Tags: 2.20.2-1ubuntu1
* Sync with Debian
* debian/control.in:
  - Depends on ghostscript-x
  - updated Build-Depends for lpi and hildon changes
  - updated maintainer informationx
* debian/patches/01_launchpad.patch:
  - launchpad integration changes
* debian/patches/03_hildon_interface.patch
  Adds support for Hildon interface with including:
  - Registration of the program into the hildon enviromment.
  - D-bus processing via ossolib.
  - Changed selection and button event handling to match Hildon model.
  - Changes in accelerators handling Zoom, Fullscreen and Presentation
    modes.
  - Uses Hildon chooser dialog.
  - Selects the Hildon interface definition file when in Hildon mode.
  - If the arch is not lpia, the standard gtk interface is used.
  - Fixes interface rendering problem when compiled for lpia.
  - Adjusted the Makefile.am files to include the Hildon interface
    options and interface file evince-hildon-ui.xml.
* debian/patches/99_autoreconf.patch:
  - updated
* debian/rules:
  - do not remove the documentation
  - use the hildon configure option during the lpia build

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
#include "ev-attachment.h"
49
49
#include "ev-image.h"
50
50
 
51
 
#if defined (HAVE_CAIRO_PDF) || defined (HAVE_CAIRO_PS)
 
51
#if (defined (HAVE_POPPLER_PAGE_RENDER) || defined (HAVE_POPPLER_PAGE_RENDER_FOR_PRINTING)) && (defined (HAVE_CAIRO_PDF) || defined (HAVE_CAIRO_PS))
52
52
#define HAVE_CAIRO_PRINT
53
53
#endif
54
54
 
1520
1520
{
1521
1521
        PdfDocument *pdf_document = PDF_DOCUMENT (exporter);
1522
1522
        PdfPrintContext *ctx;
 
1523
#ifdef HAVE_CAIRO_PRINT
1523
1524
        gdouble width, height;
1524
 
#ifdef HAVE_CAIRO_PRINT
1525
1525
        cairo_surface_t *surface = NULL;
1526
1526
#endif
1527
1527
        
1530
1530
        pdf_document->print_ctx = g_new0 (PdfPrintContext, 1);
1531
1531
        ctx = pdf_document->print_ctx;
1532
1532
        ctx->format = fc->format;
1533
 
        ctx->pages_per_sheet = fc->pages_per_sheet;
 
1533
        
 
1534
#ifdef HAVE_CAIRO_PRINT
 
1535
        ctx->pages_per_sheet = CLAMP (fc->pages_per_sheet, 1, 16);
1534
1536
 
1535
1537
        ctx->paper_width = fc->paper_width;
1536
1538
        ctx->paper_height = fc->paper_height;
1564
1566
        }
1565
1567
 
1566
1568
        ctx->pages_printed = 0;
1567
 
 
 
1569
        
1568
1570
        switch (fc->format) {
1569
1571
                case EV_FILE_FORMAT_PS:
1570
1572
#ifdef HAVE_CAIRO_PS
1571
1573
                        surface = cairo_ps_surface_create (fc->filename, fc->paper_width, fc->paper_height);
1572
 
#else
1573
 
                        ctx->ps_file = poppler_ps_file_new (pdf_document->document,
1574
 
                                                            fc->filename, fc->first_page,
1575
 
                                                            fc->last_page - fc->first_page + 1);
1576
 
                        poppler_ps_file_set_paper_size (ctx->ps_file, fc->paper_width, fc->paper_height);
1577
 
                        poppler_ps_file_set_duplex (ctx->ps_file, fc->duplex);
1578
 
#endif /* HAVE_CAIRO_PS */
 
1574
#endif
1579
1575
                        break;
1580
1576
                case EV_FILE_FORMAT_PDF:
1581
1577
#ifdef HAVE_CAIRO_PDF
1586
1582
                        g_assert_not_reached ();
1587
1583
        }
1588
1584
 
1589
 
#ifdef HAVE_CAIRO_PRINT
1590
1585
        ctx->cr = cairo_create (surface);
1591
1586
        cairo_surface_destroy (surface);
1592
 
#endif
 
1587
 
 
1588
#else /* HAVE_CAIRO_PRINT */
 
1589
        if (ctx->format == EV_FILE_FORMAT_PS) {
 
1590
                ctx->ps_file = poppler_ps_file_new (pdf_document->document,
 
1591
                                                    fc->filename, fc->first_page,
 
1592
                                                    fc->last_page - fc->first_page + 1);
 
1593
                poppler_ps_file_set_paper_size (ctx->ps_file, fc->paper_width, fc->paper_height);
 
1594
                poppler_ps_file_set_duplex (ctx->ps_file, fc->duplex);
 
1595
        }
 
1596
#endif /* HAVE_CAIRO_PRINT */
1593
1597
}
1594
1598
 
1595
1599
static void
1601
1605
        g_return_if_fail (pdf_document->print_ctx != NULL);
1602
1606
 
1603
1607
        ctx->pages_printed = 0;
1604
 
 
 
1608
        
 
1609
#ifdef HAVE_CAIRO_PRINT
1605
1610
        if (ctx->paper_width > ctx->paper_height) {
1606
1611
                if (ctx->format == EV_FILE_FORMAT_PS) {
1607
1612
                        cairo_ps_surface_set_size (cairo_get_target (ctx->cr),
1613
1618
                                                    ctx->paper_width);
1614
1619
                }
1615
1620
        }
 
1621
#endif /* HAVE_CAIRO_PRINT */
1616
1622
}
1617
1623
 
1618
1624
static void
1739
1745
        
1740
1746
        g_return_if_fail (pdf_document->print_ctx != NULL);
1741
1747
 
 
1748
#ifdef HAVE_CAIRO_PRINT
1742
1749
        cairo_show_page (ctx->cr);
 
1750
#endif
1743
1751
}
1744
1752
 
1745
1753
static void