class Cairo::PDFSurface - cairo-1.16.4 Documentation

# class Cairo::PDFSurface

PDF surface

### Public Instance Methods

add_outline(p1, p2, p3, p4) click to toggle source

    static VALUE
    cr_pdf_surface_add_outline (VALUE self,
                                VALUE rb_parent_id,
                                VALUE rb_name,
                                VALUE rb_destination,
                                VALUE rb_flags)
    {
      cairo_surface_t *surface;
      int parent_id;
      const char *name;
      const char *destination;
      cairo_pdf_outline_flags_t flags;
      int id;

      surface = _SELF;
      if (NIL_P (rb_parent_id))
        parent_id = 0;
      else
        parent_id = NUM2INT (rb_parent_id);
      name = RVAL2CSTR (rb_name);
      destination = RVAL2CSTR (rb_destination);
      if (NIL_P (rb_flags))
        flags = 0;
      else
        flags = RVAL2CRPDFOUTLINEFLAGS (rb_flags);
      id = cairo_pdf_surface_add_outline (surface,
                                          parent_id,
                                          name,
                                          destination,
                                          flags);
      rb_cairo_surface_check_status (surface);

      if (id == 0)
        return Qnil;
      else
        return INT2NUM (id);
    }

restrict_to_version(p1) click to toggle source

    static VALUE
    cr_pdf_surface_restrict_to_version (VALUE self, VALUE version)
    {
      cairo_pdf_surface_restrict_to_version (_SELF, RVAL2CRPDFVERSION (version));
      rb_cairo_surface_check_status (_SELF);
      return Qnil;
    }

set_metadata(p1, p2) click to toggle source

    static VALUE
    cr_pdf_surface_set_metadata (VALUE self,
                                 VALUE rb_metadata,
                                 VALUE rb_value)
    {
      cairo_surface_t *surface;
      cairo_pdf_metadata_t metadata;
      const char *value;

      surface = _SELF;
      metadata = RVAL2CRPDFMETADATA (rb_metadata);
      switch (metadata)
        {
        case CAIRO_PDF_METADATA_CREATE_DATE:
        case CAIRO_PDF_METADATA_MOD_DATE:
          if (rb_cairo__is_kind_of (rb_value, rb_cTime))
            {
              ID id_iso8601;
              CONST_ID(id_iso8601, "iso8601");
              rb_value = rb_funcall (rb_value, id_iso8601, 0);
            }
          break;
        default:
          break;
        }
      value = RVAL2CSTR (rb_value);
      cairo_pdf_surface_set_metadata (surface, metadata, value);
      rb_cairo_surface_check_status (surface);

      return Qnil;
    }

set_page_label(p1) click to toggle source

    static VALUE
    cr_pdf_surface_set_page_label (VALUE self,
                                   VALUE rb_label)
    {
      cairo_surface_t *surface;
      const char *label;

      surface = _SELF;
      label = RVAL2CSTR (rb_label);
      cairo_pdf_surface_set_page_label (surface, label);
      rb_cairo_surface_check_status (surface);

      return Qnil;
    }

set_thumbnail_size(p1, p2) click to toggle source

    static VALUE
    cr_pdf_surface_set_thumbnail_size (VALUE self,
                                       VALUE rb_width,
                                       VALUE rb_height)
    {
      cairo_surface_t *surface;
      int width;
      int height;

      surface = _SELF;
      width = NUM2INT (rb_width);
      height = NUM2INT (rb_height);
      cairo_pdf_surface_set_thumbnail_size (surface, width, height);
      rb_cairo_surface_check_status (surface);

      return Qnil;
    }