Class: PdflibMini::Pdflib
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- PdflibMini::Pdflib
- Defined in:
- lib/pdflib_mini/pdflib.rb
Instance Method Summary collapse
-
#add_path_point(*args, &block) ⇒ Object
7.6 Path Objects int add_path_point(int path, float x, float y, string type, string optlist) delete_path(int path).
-
#add_portfolio_folder(*args) ⇒ Object
12.6 PDF Packages and Portfolios int add_portfolio_folder(int parent, string foldername, string optlist).
-
#add_table_cell(table, column, row, text, create_optlist, delete_optlist = '', &block) ⇒ Object
5.3 Table Formatting int add_table_cell(int table, int column, int row, string text, string optlist) delete_table(int table, string optlist).
-
#add_textflow(*args, &block) ⇒ Object
5.2 Multi-Line Text with Textflows int add_textflow(int textflow, string text, string optlist) delete_textflow(int textflow).
-
#align(*args, &block) ⇒ Object
7.3 Coordinate System Transformations align(float dx, float dy).
-
#begin_document(filename, begin_optlist, end_optlist = '', &block) ⇒ Object
3.1 Document Functions int begin_document(string filename, string optlist) end_document(string optlist).
-
#begin_dpart(begin_optlist, end_optlist = '', &block) ⇒ Object
14.5 Document Part Hierarchy begin_dpart(string optlist) end_dpart(string optlist).
-
#begin_font(*args, &block) ⇒ Object
4.4 User-defined (Type 3) Fonts begin_font(String fontname, double a, double b, double c, double d, double e, double f, String optlist) end_font( ).
-
#begin_glyph_ext(*args, &block) ⇒ Object
4.4 User-defined (Type 3) Fonts begin_glyph_ext(int uv, string optlist) end_glyph( ).
-
#begin_item(*args, &block) ⇒ Object
14.3 Tagged PDF int begin_item(string tagname, string optlist) end_item(int id).
-
#begin_layer(layer, &block) ⇒ Object
3.4 Layers begin_layer(int layer) end_layer( ).
-
#begin_mc(*args, &block) ⇒ Object
14.4 Marked Content begin_mc(string tagname, string optlist) end_mc( ).
-
#begin_page_ext(width, height, begin_optlist, end_optlist = '', &block) ⇒ Object
3.3 Page Functions begin_page_ext(float width, float height, string optlist) end_page_ext(string optlist).
-
#begin_pattern_ext(*args) ⇒ Object
8.3 Patterns and Shadings int begin_pattern_ext(float width, float height, string optlist).
-
#begin_template_ext(*args, &block) ⇒ Object
9.3 Templates int begin_template_ext(float width, float height, string optlist) end_template_ext(float width, float height).
-
#clip(&block) ⇒ Object
7.5 Painting and Clipping clip( ).
-
#closepath_fill_stroke(&block) ⇒ Object
7.5 Painting and Clipping closepath_fill_stroke( ).
-
#closepath_stroke(&block) ⇒ Object
7.5 Painting and Clipping closepath_stroke( ).
-
#concat(*args, &block) ⇒ Object
7.3 Coordinate System Transformations concat(float a, float b, float c, float d, float e, float f).
-
#create_3dview(*args) ⇒ Object
13.1 3D Artwork int create_3dview(string username, string optlist).
-
#create_action(*args) ⇒ Object
12.4 Actions int create_action(string type, string optlist).
-
#create_bookmark(*args) ⇒ Object
12.1 Bookmarks int create_bookmark(string text, string optlist).
-
#create_gstate(*args) ⇒ Object
7.2 Graphics State int create_gstate(string optlist).
-
#create_textflow(*args, &block) ⇒ Object
5.2 Multi-Line Text with Textflows int create_textflow(string text, string optlist) delete_textflow(int textflow).
-
#create_textline(text) ⇒ Object
5.1 Single-Line Text with Textlines pseudo.
-
#define_layer(*args) ⇒ Object
3.4 Layers int define_layer(string name, string optlist).
-
#fill(&block) ⇒ Object
7.5 Painting and Clipping fill( ).
-
#fill_stroke(&block) ⇒ Object
7.5 Painting and Clipping fill_stroke( ).
-
#initialize(p) ⇒ Pdflib
constructor
A new instance of Pdflib.
-
#load_3ddata(*args) ⇒ Object
13.1 3D Artwork int load_3ddata(string filename, string optlist).
-
#load_asset(*args) ⇒ Object
13.2 Asset and Rich Media Features (Flash) int load_asset(string type, string filename, string optlist).
-
#load_font(*args, &block) ⇒ Object
4.1 Font Handling int load_font(string fontname, string encoding, string optlist) close_font(int font).
-
#load_graphics(*args) ⇒ Object
9.2 SVG Graphics int load_graphics(string type, string filename, string optlist).
-
#load_iccprofile(*args) ⇒ Object
8.2 ICC Profiles int load_iccprofile(string profilename, string optlist).
-
#load_image(*args) ⇒ Object
9.1 Images int load_image(string imagetype, string filename, string optlist).
-
#makespotcolor(*args) ⇒ Object
8.1 Setting Color int makespotcolor(string spotname).
-
#open_pdi_document(*args, &block) ⇒ Object
10.1 Document Functions int open_pdi_document(string filename, string optlist) close_pdi_document(int doc).
-
#open_pdi_page(*args, &block) ⇒ Object
10.2 Page Functions int open_pdi_page(int doc, int pagenumber, string optlist) close_pdi_page(int page).
-
#root_portfolio_folder ⇒ Object
pseudo.
-
#rotate(*args, &block) ⇒ Object
7.3 Coordinate System Transformations rotate(float phi).
-
#save(&block) ⇒ Object
7.2 Graphics State save( ) restore( ).
-
#scale(*args, &block) ⇒ Object
7.3 Coordinate System Transformations scale(float sx, float sy).
-
#setmatrix(*args, &block) ⇒ Object
7.3 Coordinate System Transformations setmatrix(float a, float b, float c, float d, float e, float f).
-
#shading(*args) ⇒ Object
8.3 Patterns and Shadings int shading(string shtype, float x0, float y0, float x1, float y1, float c1, float c2, float c3, float c4, string optlist).
-
#shading_pattern(*args) ⇒ Object
8.3 Patterns and Shadings int shading_pattern(int shading, string optlist).
-
#skew(*args, &block) ⇒ Object
7.3 Coordinate System Transformations skew(float alpha, float beta).
-
#stroke(&block) ⇒ Object
7.5 Painting and Clipping stroke( ).
-
#translate(*args, &block) ⇒ Object
7.3 Coordinate System Transformations translate(float tx, float ty).
Constructor Details
#initialize(p) ⇒ Pdflib
Returns a new instance of Pdflib.
3 4 5 |
# File 'lib/pdflib_mini/pdflib.rb', line 3 def initialize(p) super p end |
Instance Method Details
#add_path_point(*args, &block) ⇒ Object
7.6 Path Objects int add_path_point(int path, float x, float y, string type, string optlist) delete_path(int path)
281 282 283 284 285 286 287 288 |
# File 'lib/pdflib_mini/pdflib.rb', line 281 def add_path_point(*args, &block) Handle::Path.create(super(*args), self).tap do |path| if block_given? block.call(path, self) path.delete_path if path != -1 end end end |
#add_portfolio_folder(*args) ⇒ Object
12.6 PDF Packages and Portfolios int add_portfolio_folder(int parent, string foldername, string optlist)
394 395 396 |
# File 'lib/pdflib_mini/pdflib.rb', line 394 def add_portfolio_folder(*args) Handle::Folder.create(super(*args), self) end |
#add_table_cell(table, column, row, text, create_optlist, delete_optlist = '', &block) ⇒ Object
5.3 Table Formatting int add_table_cell(int table, int column, int row, string text, string optlist) delete_table(int table, string optlist)
118 119 120 121 122 123 124 125 |
# File 'lib/pdflib_mini/pdflib.rb', line 118 def add_table_cell(table, column, row, text, create_optlist, delete_optlist = '', &block) Handle::TableCell.create(super(table, column, row, text, create_optlist), self).tap do |table_cell| if block_given? block.call(table_cell, self) table_cell.delete_table(delete_optlist) if table_cell != -1 end end end |
#add_textflow(*args, &block) ⇒ Object
5.2 Multi-Line Text with Textflows int add_textflow(int textflow, string text, string optlist) delete_textflow(int textflow)
94 95 96 97 98 99 100 101 |
# File 'lib/pdflib_mini/pdflib.rb', line 94 def add_textflow(*args, &block) Handle::Textflow.create(super(*args), self).tap do |textflow| if block_given? block.call(textflow, self) textflow.delete_textflow if textflow != -1 end end end |
#align(*args, &block) ⇒ Object
7.3 Coordinate System Transformations align(float dx, float dy)
186 187 188 189 190 191 192 193 194 195 |
# File 'lib/pdflib_mini/pdflib.rb', line 186 def align(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |
#begin_document(filename, begin_optlist, end_optlist = '', &block) ⇒ Object
3.1 Document Functions int begin_document(string filename, string optlist) end_document(string optlist)
10 11 12 13 14 15 16 17 |
# File 'lib/pdflib_mini/pdflib.rb', line 10 def begin_document(filename, begin_optlist, end_optlist = '', &block) super(filename, begin_optlist).tap do |result| if block_given? block.call(result, self) end_document(end_optlist) if result != -1 end end end |
#begin_dpart(begin_optlist, end_optlist = '', &block) ⇒ Object
14.5 Document Part Hierarchy begin_dpart(string optlist) end_dpart(string optlist)
448 449 450 451 452 453 454 455 |
# File 'lib/pdflib_mini/pdflib.rb', line 448 def begin_dpart(begin_optlist, end_optlist = '', &block) super(begin_optlist).tap do if block_given? block.call(self) end_dpart(end_optlist) end end end |
#begin_font(*args, &block) ⇒ Object
4.4 User-defined (Type 3) Fonts begin_font(String fontname, double a, double b, double c, double d, double e, double f, String optlist) end_font( )
64 65 66 67 68 69 70 71 |
# File 'lib/pdflib_mini/pdflib.rb', line 64 def begin_font(*args, &block) super(*args).tap do if block_given? block.call(self) end_font end end end |
#begin_glyph_ext(*args, &block) ⇒ Object
4.4 User-defined (Type 3) Fonts begin_glyph_ext(int uv, string optlist) end_glyph( )
76 77 78 79 80 81 82 83 |
# File 'lib/pdflib_mini/pdflib.rb', line 76 def begin_glyph_ext(*args, &block) super(*args).tap do if block_given? block.call(self) end_glyph end end end |
#begin_item(*args, &block) ⇒ Object
14.3 Tagged PDF int begin_item(string tagname, string optlist) end_item(int id)
424 425 426 427 428 429 430 431 |
# File 'lib/pdflib_mini/pdflib.rb', line 424 def begin_item(*args, &block) Handle::Item.create(super(*args), self).tap do |item| if block_given? block.call(item, self) item.end_item if item != -1 end end end |
#begin_layer(layer, &block) ⇒ Object
3.4 Layers begin_layer(int layer) end_layer( )
40 41 42 43 44 45 46 47 |
# File 'lib/pdflib_mini/pdflib.rb', line 40 def begin_layer(layer, &block) super(layer).tap do if block_given? block.call(self) end_layer end end end |
#begin_mc(*args, &block) ⇒ Object
14.4 Marked Content begin_mc(string tagname, string optlist) end_mc( )
436 437 438 439 440 441 442 443 |
# File 'lib/pdflib_mini/pdflib.rb', line 436 def begin_mc(*args, &block) super(*args).tap do if block_given? block.call(self) end_mc end end end |
#begin_page_ext(width, height, begin_optlist, end_optlist = '', &block) ⇒ Object
3.3 Page Functions begin_page_ext(float width, float height, string optlist) end_page_ext(string optlist)
22 23 24 25 26 27 28 29 |
# File 'lib/pdflib_mini/pdflib.rb', line 22 def begin_page_ext(width, height, begin_optlist, end_optlist = '', &block) super(width, height, begin_optlist).tap do if block_given? block.call(self) end_page_ext(end_optlist) end end end |
#begin_pattern_ext(*args) ⇒ Object
8.3 Patterns and Shadings int begin_pattern_ext(float width, float height, string optlist)
304 305 306 |
# File 'lib/pdflib_mini/pdflib.rb', line 304 def begin_pattern_ext(*args) Handle::Pattern.create(super(*args), self) end |
#begin_template_ext(*args, &block) ⇒ Object
9.3 Templates int begin_template_ext(float width, float height, string optlist) end_template_ext(float width, float height)
335 336 337 338 339 340 341 342 |
# File 'lib/pdflib_mini/pdflib.rb', line 335 def begin_template_ext(*args, &block) Handle::Template.create(super(*args), self).tap do |template| if block_given? block.call(self) template.end_template_ext(0, 0) if template != -1 end end end |
#clip(&block) ⇒ Object
7.5 Painting and Clipping clip( )
273 274 275 276 |
# File 'lib/pdflib_mini/pdflib.rb', line 273 def clip(&block) block.call if block_given? super end |
#closepath_fill_stroke(&block) ⇒ Object
7.5 Painting and Clipping closepath_fill_stroke( )
266 267 268 269 |
# File 'lib/pdflib_mini/pdflib.rb', line 266 def closepath_fill_stroke(&block) block.call if block_given? super end |
#closepath_stroke(&block) ⇒ Object
7.5 Painting and Clipping closepath_stroke( )
245 246 247 248 |
# File 'lib/pdflib_mini/pdflib.rb', line 245 def closepath_stroke(&block) block.call if block_given? super end |
#concat(*args, &block) ⇒ Object
7.3 Coordinate System Transformations concat(float a, float b, float c, float d, float e, float f)
212 213 214 215 216 217 218 219 220 221 |
# File 'lib/pdflib_mini/pdflib.rb', line 212 def concat(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |
#create_3dview(*args) ⇒ Object
13.1 3D Artwork int create_3dview(string username, string optlist)
411 412 413 |
# File 'lib/pdflib_mini/pdflib.rb', line 411 def create_3dview(*args) Handle::Data3dView.create(super(*args), self) end |
#create_action(*args) ⇒ Object
12.4 Actions int create_action(string type, string optlist)
385 386 387 |
# File 'lib/pdflib_mini/pdflib.rb', line 385 def create_action(*args) Handle::Action.create(super(*args), self) end |
#create_bookmark(*args) ⇒ Object
12.1 Bookmarks int create_bookmark(string text, string optlist)
370 371 372 |
# File 'lib/pdflib_mini/pdflib.rb', line 370 def create_bookmark(*args) Handle::Bookmark.create(super(*args), self) end |
#create_gstate(*args) ⇒ Object
7.2 Graphics State int create_gstate(string optlist)
129 130 131 |
# File 'lib/pdflib_mini/pdflib.rb', line 129 def create_gstate(*args) Handle::GraphicsState.create(super(*args), self) end |
#create_textflow(*args, &block) ⇒ Object
5.2 Multi-Line Text with Textflows int create_textflow(string text, string optlist) delete_textflow(int textflow)
106 107 108 109 110 111 112 113 |
# File 'lib/pdflib_mini/pdflib.rb', line 106 def create_textflow(*args, &block) Handle::Textflow.create(super(*args), self).tap do |textflow| if block_given? block.call(textflow, self) textflow.delete_textflow if textflow != -1 end end end |
#create_textline(text) ⇒ Object
5.1 Single-Line Text with Textlines pseudo
87 88 89 |
# File 'lib/pdflib_mini/pdflib.rb', line 87 def create_textline(text) Handle::Textline.create(text, self) end |
#define_layer(*args) ⇒ Object
3.4 Layers int define_layer(string name, string optlist)
33 34 35 |
# File 'lib/pdflib_mini/pdflib.rb', line 33 def define_layer(*args) Handle::Layer.create(super(*args), self) end |
#fill(&block) ⇒ Object
7.5 Painting and Clipping fill( )
252 253 254 255 |
# File 'lib/pdflib_mini/pdflib.rb', line 252 def fill(&block) block.call if block_given? super end |
#fill_stroke(&block) ⇒ Object
7.5 Painting and Clipping fill_stroke( )
259 260 261 262 |
# File 'lib/pdflib_mini/pdflib.rb', line 259 def fill_stroke(&block) block.call if block_given? super end |
#load_3ddata(*args) ⇒ Object
13.1 3D Artwork int load_3ddata(string filename, string optlist)
405 406 407 |
# File 'lib/pdflib_mini/pdflib.rb', line 405 def load_3ddata(*args) Handle::Data3d.create(super(*args), self) end |
#load_asset(*args) ⇒ Object
13.2 Asset and Rich Media Features (Flash) int load_asset(string type, string filename, string optlist)
417 418 419 |
# File 'lib/pdflib_mini/pdflib.rb', line 417 def load_asset(*args) Handle::Asset.create(super(*args), self) end |
#load_font(*args, &block) ⇒ Object
4.1 Font Handling int load_font(string fontname, string encoding, string optlist) close_font(int font)
52 53 54 55 56 57 58 59 |
# File 'lib/pdflib_mini/pdflib.rb', line 52 def load_font(*args, &block) Handle::Font.create(super(*args), self).tap do |font| if block_given? block.call(font, self) font.close_font if font != -1 end end end |
#load_graphics(*args) ⇒ Object
9.2 SVG Graphics int load_graphics(string type, string filename, string optlist)
328 329 330 |
# File 'lib/pdflib_mini/pdflib.rb', line 328 def load_graphics(*args) Handle::Graphics.create(super(*args), self) end |
#load_iccprofile(*args) ⇒ Object
8.2 ICC Profiles int load_iccprofile(string profilename, string optlist)
298 299 300 |
# File 'lib/pdflib_mini/pdflib.rb', line 298 def load_iccprofile(*args) Handle::Profile.create(super(*args), self) end |
#load_image(*args) ⇒ Object
9.1 Images int load_image(string imagetype, string filename, string optlist)
322 323 324 |
# File 'lib/pdflib_mini/pdflib.rb', line 322 def load_image(*args) Handle::Image.create(super(*args), self) end |
#makespotcolor(*args) ⇒ Object
8.1 Setting Color int makespotcolor(string spotname)
292 293 294 |
# File 'lib/pdflib_mini/pdflib.rb', line 292 def makespotcolor(*args) Handle::Color.create(super(*args), self) end |
#open_pdi_document(*args, &block) ⇒ Object
10.1 Document Functions int open_pdi_document(string filename, string optlist) close_pdi_document(int doc)
347 348 349 350 351 352 353 354 |
# File 'lib/pdflib_mini/pdflib.rb', line 347 def open_pdi_document(*args, &block) Handle::Pdf::Document.create(super(*args), self, args.first).tap do |doc| if block_given? block.call(doc, self) doc.close_pdi_document if doc != -1 end end end |
#open_pdi_page(*args, &block) ⇒ Object
10.2 Page Functions int open_pdi_page(int doc, int pagenumber, string optlist) close_pdi_page(int page)
359 360 361 362 363 364 365 366 |
# File 'lib/pdflib_mini/pdflib.rb', line 359 def open_pdi_page(*args, &block) Handle::Pdf::Page.create(super(*args), args.first, self).tap do |page| if block_given? block.call(page, args.first, self) page.close_pdi_page if page != -1 end end end |
#root_portfolio_folder ⇒ Object
pseudo
399 400 401 |
# File 'lib/pdflib_mini/pdflib.rb', line 399 def root_portfolio_folder Handle::Folder.new(-1, self) end |
#rotate(*args, &block) ⇒ Object
7.3 Coordinate System Transformations rotate(float phi)
173 174 175 176 177 178 179 180 181 182 |
# File 'lib/pdflib_mini/pdflib.rb', line 173 def rotate(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |
#save(&block) ⇒ Object
7.2 Graphics State save( ) restore( )
136 137 138 139 140 141 142 143 |
# File 'lib/pdflib_mini/pdflib.rb', line 136 def save(&block) super.tap do if block_given? block.call(self) restore end end end |
#scale(*args, &block) ⇒ Object
7.3 Coordinate System Transformations scale(float sx, float sy)
160 161 162 163 164 165 166 167 168 169 |
# File 'lib/pdflib_mini/pdflib.rb', line 160 def scale(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |
#setmatrix(*args, &block) ⇒ Object
7.3 Coordinate System Transformations setmatrix(float a, float b, float c, float d, float e, float f)
225 226 227 228 229 230 231 232 233 234 |
# File 'lib/pdflib_mini/pdflib.rb', line 225 def setmatrix(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |
#shading(*args) ⇒ Object
8.3 Patterns and Shadings int shading(string shtype, float x0, float y0, float x1, float y1, float c1, float c2, float c3, float c4, string optlist)
316 317 318 |
# File 'lib/pdflib_mini/pdflib.rb', line 316 def shading(*args) Handle::Shading.create(super(*args), self) end |
#shading_pattern(*args) ⇒ Object
8.3 Patterns and Shadings int shading_pattern(int shading, string optlist)
310 311 312 |
# File 'lib/pdflib_mini/pdflib.rb', line 310 def shading_pattern(*args) Handle::Pattern.create(super(*args), self) end |
#skew(*args, &block) ⇒ Object
7.3 Coordinate System Transformations skew(float alpha, float beta)
199 200 201 202 203 204 205 206 207 208 |
# File 'lib/pdflib_mini/pdflib.rb', line 199 def skew(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |
#stroke(&block) ⇒ Object
7.5 Painting and Clipping stroke( )
238 239 240 241 |
# File 'lib/pdflib_mini/pdflib.rb', line 238 def stroke(&block) block.call if block_given? super end |
#translate(*args, &block) ⇒ Object
7.3 Coordinate System Transformations translate(float tx, float ty)
147 148 149 150 151 152 153 154 155 156 |
# File 'lib/pdflib_mini/pdflib.rb', line 147 def translate(*args, &block) if block_given? save do super(*args) block.call end else super(*args) end end |