Class: GrabzIt::PDFOptions
- Inherits:
-
BaseOptions
- Object
- BaseOptions
- GrabzIt::PDFOptions
- Defined in:
- lib/grabzit/pdfoptions.rb
Overview
Represents all of the options available when creating a PDF
Instance Method Summary collapse
-
#add_post_parameter(name, value) ⇒ Object
Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters.
-
#add_template_parameter(name, value) ⇒ Object
Define a custom template parameter and value, this method can be called multiple times to add multiple parameters.
-
#address ⇒ String
Get the URL to execute the HTML code in.
-
#address=(value) ⇒ void
Set the URL to execute the HTML code in.
-
#browserWidth ⇒ Integer
The width of the browser in pixels.
-
#browserWidth=(value) ⇒ void
Set the width of the browser in pixels.
-
#clickElement ⇒ String
Get the CSS selector of the HTML element in the web page that must clicked before the capture is performed.
-
#clickElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed.
-
#coverURL ⇒ String
The URL of a web page that should be used as a cover page for the PDF.
-
#coverURL=(value) ⇒ void
Set the URL of a web page that should be used as a cover page for the PDF.
-
#cssMediaType ⇒ String
The CSS Media Type of the PDF to be returned.
-
#cssMediaType=(value) ⇒ void
Set the CSS Media Type of the PDF to be returned: ‘Print’ or ‘Screen’.
-
#customWaterMarkId ⇒ String
The custom watermark id.
-
#customWaterMarkId=(value) ⇒ void
Set a custom watermark to add to the PDF.
-
#delay ⇒ Integer
The number of milliseconds to wait before creating the capture.
-
#delay=(value) ⇒ void
Set the number of milliseconds to wait before creating the capture.
-
#hideElement ⇒ String
Get the CSS selector(s) of the one or more HTML elements in the web page to hide.
-
#hideElement=(value) ⇒ void
Set the CSS selector(s) of the one or more HTML elements in the web page to hide.
-
#hoverElement ⇒ String
Get the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.
-
#hoverElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.
-
#includeBackground ⇒ Boolean
True if the background of the web page should be included in the PDF.
-
#includeBackground=(value) ⇒ void
Set to true if the background of the web page should be included in the PDF.
-
#includeLinks ⇒ Boolean
True if the links should be included in the PDF.
-
#includeLinks=(value) ⇒ void
Set to true if links should be included in the PDF.
-
#includeOutline ⇒ Boolean
True if the PDF outline should be included.
-
#includeOutline=(value) ⇒ void
Set to true if the PDF outline should be included.
-
#initialize ⇒ PDFOptions
constructor
A new instance of PDFOptions.
-
#jsCode ⇒ String
Get the JavaScript code that will be execute in the web page before the capture is performed.
-
#jsCode=(value) ⇒ void
Set the JavaScript code that will be execute in the web page before the capture is performed.
-
#marginBottom ⇒ Integer
The margin that should appear at the bottom of the PDF document page.
-
#marginBottom=(value) ⇒ void
Set the margin that should appear at the bottom of the PDF document page.
-
#marginLeft ⇒ Integer
The margin that should appear at the left of the PDF document page.
-
#marginLeft=(value) ⇒ void
Set the margin that should appear at the left of the PDF document page.
-
#marginRight ⇒ Integer
The margin that should appear at the right of the PDF document.
-
#marginRight=(value) ⇒ void
Set the margin that should appear at the right of the PDF document.
-
#marginTop ⇒ Integer
The margin that should appear at the top of the PDF document page.
-
#marginTop=(value) ⇒ void
Set the margin that should appear at the top of the PDF document page.
-
#mergeId ⇒ String
Get the ID of a capture that should be merged at the beginning of the new PDF document.
-
#mergeId=(value) ⇒ void
Set the ID of a capture that should be merged at the beginning of the new PDF document.
-
#noAds ⇒ Boolean
Get if adverts should be automatically hidden.
-
#noAds=(value) ⇒ void
Set to true if adverts should be automatically hidden.
-
#noCookieNotifications ⇒ Boolean
Get if cookie notifications should be automatically hidden.
-
#noCookieNotifications=(value) ⇒ void
Set to true if cookie notifications should be automatically hidden.
-
#orientation ⇒ String
The orientation of the PDF to be returned.
-
#orientation=(value) ⇒ void
Set the orientation of the PDF to be returned: ‘Landscape’ or ‘Portrait’.
-
#pageHeight ⇒ Integer
Get the page height of the resulting PDF in mm.
-
#pageHeight=(value) ⇒ void
Set the page height of the resulting PDF in mm.
-
#pagesize ⇒ String
The page size of the PDF to be returned.
-
#pagesize=(value) ⇒ void
Set the page size of the PDF to be returned: ‘A3’, ‘A4’, ‘A5’, ‘A6’, ‘B3’, ‘B4’, ‘B5’, ‘B6’, ‘Letter’.
-
#pageWidth ⇒ Integer
Get the page width of the resulting PDF in mm.
-
#pageWidth=(value) ⇒ void
Set the page width of the resulting PDF in mm.
-
#password ⇒ String
Get the password that protects the PDF document.
-
#password=(value) ⇒ void
Set the password that protects the PDF document.
-
#quality ⇒ Integer
The quality of the PDF.
-
#quality=(value) ⇒ void
Set the quality of the PDF where 0 is poor and 100 excellent.
-
#requestAs ⇒ Integer
Get which user agent type should be used.
-
#requestAs=(value) ⇒ void
Set which user agent type should be used: Standard Browser = 0, Mobile Browser = 1, Search Engine = 2 and Fallback Browser = 3.
-
#scrollElement ⇒ String
Get the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.
-
#scrollElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.
-
#targetElement ⇒ String
Get the CSS selector of the only HTML element in the web page to capture.
-
#targetElement=(value) ⇒ void
Set the CSS selector of the only HTML element in the web page to capture.
-
#templateId ⇒ String
The template ID that specifies the header and footer of the PDF document.
-
#templateId=(value) ⇒ void
Set a template ID that specifies the header and footer of the PDF document.
-
#title ⇒ String
A title for the PDF document.
-
#title=(value) ⇒ void
Set a title for the PDF document.
-
#waitForElement ⇒ String
Get the CSS selector of the HTML element in the web page that must be visible before the capture is performed.
-
#waitForElement=(value) ⇒ void
Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed.
Methods inherited from BaseOptions
#country, #country=, #customId, #customId=, #encryptionKey, #encryptionKey=, #exportURL, #exportURL=, #proxy, #proxy=
Constructor Details
#initialize ⇒ PDFOptions
Returns a new instance of PDFOptions.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/grabzit/pdfoptions.rb', line 8 def initialize() super() @includeBackground = true @pagesize = 'A4' @orientation = 'Portrait' @includeLinks = true @includeOutline = false @title = nil @coverURL = nil @marginTop = 10 @marginLeft = 10 @marginBottom = 10 @marginRight = 10 @requestAs = 0 @templateId = nil @customWaterMarkId = nil @quality = -1 @targetElement = nil @hideElement = nil @waitForElement = nil @noAds = false @browserWidth = nil @templateVariables = nil @width = nil @height = nil @mergeId = nil @noCookieNotifications = false @address = nil @cssMediaType = nil @password = nil @clickElement = nil @jsCode = nil @scrollElement = nil @hoverElement = nil end |
Instance Method Details
#add_post_parameter(name, value) ⇒ Object
Define a HTTP Post parameter and optionally value, this method can be called multiple times to add multiple parameters. Using this method will force GrabzIt to perform a HTTP post.
468 469 470 |
# File 'lib/grabzit/pdfoptions.rb', line 468 def add_post_parameter(name, value) @post = appendParameter(@post, name, value) end |
#add_template_parameter(name, value) ⇒ Object
Define a custom template parameter and value, this method can be called multiple times to add multiple parameters.
476 477 478 |
# File 'lib/grabzit/pdfoptions.rb', line 476 def add_template_parameter(name, value) @templateVariables = appendParameter(@templateVariables, name, value) end |
#address ⇒ String
Returns get the URL to execute the HTML code in.
425 426 427 |
# File 'lib/grabzit/pdfoptions.rb', line 425 def address @address end |
#address=(value) ⇒ void
This method returns an undefined value.
Set the URL to execute the HTML code in
433 434 435 |
# File 'lib/grabzit/pdfoptions.rb', line 433 def address=(value) @address = value end |
#browserWidth ⇒ Integer
Returns the width of the browser in pixels.
204 205 206 |
# File 'lib/grabzit/pdfoptions.rb', line 204 def browserWidth @browserWidth end |
#browserWidth=(value) ⇒ void
This method returns an undefined value.
Set the width of the browser in pixels
212 213 214 |
# File 'lib/grabzit/pdfoptions.rb', line 212 def browserWidth=(value) @browserWidth = value end |
#clickElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must clicked before the capture is performed.
347 348 349 |
# File 'lib/grabzit/pdfoptions.rb', line 347 def clickElement @clickElement end |
#clickElement=(value) ⇒ void
This method returns an undefined value.
Set the CSS selector of the HTML element in the web page that must clicked before the capture is performed
355 356 357 |
# File 'lib/grabzit/pdfoptions.rb', line 355 def clickElement=(value) @clickElement = value end |
#coverURL ⇒ String
Returns the URL of a web page that should be used as a cover page for the PDF.
139 140 141 |
# File 'lib/grabzit/pdfoptions.rb', line 139 def coverURL @coverURL end |
#coverURL=(value) ⇒ void
This method returns an undefined value.
Set the URL of a web page that should be used as a cover page for the PDF
147 148 149 |
# File 'lib/grabzit/pdfoptions.rb', line 147 def coverURL=(value) @coverURL = value end |
#cssMediaType ⇒ String
Returns the CSS Media Type of the PDF to be returned.
86 87 88 |
# File 'lib/grabzit/pdfoptions.rb', line 86 def cssMediaType @cssMediaType end |
#cssMediaType=(value) ⇒ void
This method returns an undefined value.
Set the CSS Media Type of the PDF to be returned: ‘Print’ or ‘Screen’
94 95 96 97 |
# File 'lib/grabzit/pdfoptions.rb', line 94 def cssMediaType=(value) value = GrabzIt::Utility.nil_check(value).capitalize @cssMediaType = value end |
#customWaterMarkId ⇒ String
Returns the custom watermark id.
282 283 284 |
# File 'lib/grabzit/pdfoptions.rb', line 282 def customWaterMarkId @customWaterMarkId end |
#customWaterMarkId=(value) ⇒ void
This method returns an undefined value.
Set a custom watermark to add to the PDF.
290 291 292 |
# File 'lib/grabzit/pdfoptions.rb', line 290 def customWaterMarkId=(value) @customWaterMarkId = value end |
#delay ⇒ Integer
Returns the number of milliseconds to wait before creating the capture.
243 244 245 |
# File 'lib/grabzit/pdfoptions.rb', line 243 def delay @delay end |
#delay=(value) ⇒ void
This method returns an undefined value.
Set the number of milliseconds to wait before creating the capture
251 252 253 |
# File 'lib/grabzit/pdfoptions.rb', line 251 def delay=(value) @delay = value end |
#hideElement ⇒ String
Returns get the CSS selector(s) of the one or more HTML elements in the web page to hide.
321 322 323 |
# File 'lib/grabzit/pdfoptions.rb', line 321 def hideElement @hideElement end |
#hideElement=(value) ⇒ void
This method returns an undefined value.
Set the CSS selector(s) of the one or more HTML elements in the web page to hide
329 330 331 |
# File 'lib/grabzit/pdfoptions.rb', line 329 def hideElement=(value) @hideElement = value end |
#hoverElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must hovered over before the capture is performed.
373 374 375 |
# File 'lib/grabzit/pdfoptions.rb', line 373 def hoverElement @hoverElement end |
#hoverElement=(value) ⇒ void
This method returns an undefined value.
Set the CSS selector of the HTML element in the web page that must hovered over before the capture is performed
381 382 383 |
# File 'lib/grabzit/pdfoptions.rb', line 381 def hoverElement=(value) @hoverElement = value end |
#includeBackground ⇒ Boolean
Returns true if the background of the web page should be included in the PDF.
45 46 47 |
# File 'lib/grabzit/pdfoptions.rb', line 45 def includeBackground @includeBackground end |
#includeBackground=(value) ⇒ void
This method returns an undefined value.
Set to true if the background of the web page should be included in the PDF
53 54 55 |
# File 'lib/grabzit/pdfoptions.rb', line 53 def includeBackground=(value) @includeBackground = value end |
#includeLinks ⇒ Boolean
Returns true if the links should be included in the PDF.
100 101 102 |
# File 'lib/grabzit/pdfoptions.rb', line 100 def includeLinks @includeLinks end |
#includeLinks=(value) ⇒ void
This method returns an undefined value.
Set to true if links should be included in the PDF
108 109 110 |
# File 'lib/grabzit/pdfoptions.rb', line 108 def includeLinks=(value) @includeLinks = value end |
#includeOutline ⇒ Boolean
Returns true if the PDF outline should be included.
113 114 115 |
# File 'lib/grabzit/pdfoptions.rb', line 113 def includeOutline @includeOutline end |
#includeOutline=(value) ⇒ void
This method returns an undefined value.
Set to true if the PDF outline should be included
121 122 123 |
# File 'lib/grabzit/pdfoptions.rb', line 121 def includeOutline=(value) @includeOutline = value end |
#jsCode ⇒ String
Returns get the JavaScript code that will be execute in the web page before the capture is performed.
451 452 453 |
# File 'lib/grabzit/pdfoptions.rb', line 451 def jsCode @jsCode end |
#jsCode=(value) ⇒ void
This method returns an undefined value.
Set the JavaScript code that will be execute in the web page before the capture is performed
459 460 461 |
# File 'lib/grabzit/pdfoptions.rb', line 459 def jsCode=(value) @jsCode = value end |
#marginBottom ⇒ Integer
Returns the margin that should appear at the bottom of the PDF document page.
178 179 180 |
# File 'lib/grabzit/pdfoptions.rb', line 178 def marginBottom @marginBottom end |
#marginBottom=(value) ⇒ void
This method returns an undefined value.
Set the margin that should appear at the bottom of the PDF document page
186 187 188 |
# File 'lib/grabzit/pdfoptions.rb', line 186 def marginBottom=(value) @marginBottom = value end |
#marginLeft ⇒ Integer
Returns the margin that should appear at the left of the PDF document page.
165 166 167 |
# File 'lib/grabzit/pdfoptions.rb', line 165 def marginLeft @marginLeft end |
#marginLeft=(value) ⇒ void
This method returns an undefined value.
Set the margin that should appear at the left of the PDF document page
173 174 175 |
# File 'lib/grabzit/pdfoptions.rb', line 173 def marginLeft=(value) @marginLeft = value end |
#marginRight ⇒ Integer
Returns the margin that should appear at the right of the PDF document.
191 192 193 |
# File 'lib/grabzit/pdfoptions.rb', line 191 def marginRight @marginRight end |
#marginRight=(value) ⇒ void
This method returns an undefined value.
Set the margin that should appear at the right of the PDF document
199 200 201 |
# File 'lib/grabzit/pdfoptions.rb', line 199 def marginRight=(value) @marginRight = value end |
#marginTop ⇒ Integer
Returns the margin that should appear at the top of the PDF document page.
152 153 154 |
# File 'lib/grabzit/pdfoptions.rb', line 152 def marginTop @marginTop end |
#marginTop=(value) ⇒ void
This method returns an undefined value.
Set the margin that should appear at the top of the PDF document page
160 161 162 |
# File 'lib/grabzit/pdfoptions.rb', line 160 def marginTop=(value) @marginTop = value end |
#mergeId ⇒ String
Returns get the ID of a capture that should be merged at the beginning of the new PDF document.
386 387 388 |
# File 'lib/grabzit/pdfoptions.rb', line 386 def mergeId @mergeId end |
#mergeId=(value) ⇒ void
This method returns an undefined value.
Set the ID of a capture that should be merged at the beginning of the new PDF document
394 395 396 |
# File 'lib/grabzit/pdfoptions.rb', line 394 def mergeId=(value) @mergeId = value end |
#noAds ⇒ Boolean
Returns get if adverts should be automatically hidden.
399 400 401 |
# File 'lib/grabzit/pdfoptions.rb', line 399 def noAds @noAds end |
#noAds=(value) ⇒ void
This method returns an undefined value.
Set to true if adverts should be automatically hidden
407 408 409 |
# File 'lib/grabzit/pdfoptions.rb', line 407 def noAds=(value) @noAds = value end |
#noCookieNotifications ⇒ Boolean
Returns get if cookie notifications should be automatically hidden.
412 413 414 |
# File 'lib/grabzit/pdfoptions.rb', line 412 def noCookieNotifications @noCookieNotifications end |
#noCookieNotifications=(value) ⇒ void
This method returns an undefined value.
Set to true if cookie notifications should be automatically hidden
420 421 422 |
# File 'lib/grabzit/pdfoptions.rb', line 420 def noCookieNotifications=(value) @noCookieNotifications = value end |
#orientation ⇒ String
Returns the orientation of the PDF to be returned.
72 73 74 |
# File 'lib/grabzit/pdfoptions.rb', line 72 def orientation @orientation end |
#orientation=(value) ⇒ void
This method returns an undefined value.
Set the orientation of the PDF to be returned: ‘Landscape’ or ‘Portrait’
80 81 82 83 |
# File 'lib/grabzit/pdfoptions.rb', line 80 def orientation=(value) value = GrabzIt::Utility.nil_check(value).capitalize @orientation = value end |
#pageHeight ⇒ Integer
Returns get the page height of the resulting PDF in mm.
230 231 232 |
# File 'lib/grabzit/pdfoptions.rb', line 230 def pageHeight @height end |
#pageHeight=(value) ⇒ void
This method returns an undefined value.
Set the page height of the resulting PDF in mm
238 239 240 |
# File 'lib/grabzit/pdfoptions.rb', line 238 def pageHeight=(value) @height = value end |
#pagesize ⇒ String
Returns the page size of the PDF to be returned.
58 59 60 |
# File 'lib/grabzit/pdfoptions.rb', line 58 def pagesize @pagesize end |
#pagesize=(value) ⇒ void
This method returns an undefined value.
Set the page size of the PDF to be returned: ‘A3’, ‘A4’, ‘A5’, ‘A6’, ‘B3’, ‘B4’, ‘B5’, ‘B6’, ‘Letter’
66 67 68 69 |
# File 'lib/grabzit/pdfoptions.rb', line 66 def pagesize=(value) value = GrabzIt::Utility.nil_check(value).upcase @pagesize = value end |
#pageWidth ⇒ Integer
Returns get the page width of the resulting PDF in mm.
217 218 219 |
# File 'lib/grabzit/pdfoptions.rb', line 217 def pageWidth @width end |
#pageWidth=(value) ⇒ void
This method returns an undefined value.
Set the page width of the resulting PDF in mm
225 226 227 |
# File 'lib/grabzit/pdfoptions.rb', line 225 def pageWidth=(value) @width = value end |
#password ⇒ String
Returns get the password that protects the PDF document.
438 439 440 |
# File 'lib/grabzit/pdfoptions.rb', line 438 def password @password end |
#password=(value) ⇒ void
This method returns an undefined value.
Set the password that protects the PDF document
446 447 448 |
# File 'lib/grabzit/pdfoptions.rb', line 446 def password=(value) @password = value end |
#quality ⇒ Integer
Returns the quality of the PDF.
295 296 297 |
# File 'lib/grabzit/pdfoptions.rb', line 295 def quality @quality end |
#quality=(value) ⇒ void
This method returns an undefined value.
Set the quality of the PDF where 0 is poor and 100 excellent. The default is -1 which uses the recommended quality
303 304 305 |
# File 'lib/grabzit/pdfoptions.rb', line 303 def quality=(value) @quality = value end |
#requestAs ⇒ Integer
Returns get which user agent type should be used.
256 257 258 |
# File 'lib/grabzit/pdfoptions.rb', line 256 def requestAs @requestAs end |
#requestAs=(value) ⇒ void
This method returns an undefined value.
Set which user agent type should be used: Standard Browser = 0, Mobile Browser = 1, Search Engine = 2 and Fallback Browser = 3
264 265 266 |
# File 'lib/grabzit/pdfoptions.rb', line 264 def requestAs=(value) @requestAs = value end |
#scrollElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must scroll to before the capture is performed.
360 361 362 |
# File 'lib/grabzit/pdfoptions.rb', line 360 def scrollElement @scrollElement end |
#scrollElement=(value) ⇒ void
This method returns an undefined value.
Set the CSS selector of the HTML element in the web page that must scroll to before the capture is performed
368 369 370 |
# File 'lib/grabzit/pdfoptions.rb', line 368 def scrollElement=(value) @scrollElement = value end |
#targetElement ⇒ String
Returns get the CSS selector of the only HTML element in the web page to capture.
308 309 310 |
# File 'lib/grabzit/pdfoptions.rb', line 308 def targetElement @targetElement end |
#targetElement=(value) ⇒ void
This method returns an undefined value.
Set the CSS selector of the only HTML element in the web page to capture
316 317 318 |
# File 'lib/grabzit/pdfoptions.rb', line 316 def targetElement=(value) @targetElement = value end |
#templateId ⇒ String
Returns the template ID that specifies the header and footer of the PDF document.
269 270 271 |
# File 'lib/grabzit/pdfoptions.rb', line 269 def templateId @templateId end |
#templateId=(value) ⇒ void
This method returns an undefined value.
Set a template ID that specifies the header and footer of the PDF document
277 278 279 |
# File 'lib/grabzit/pdfoptions.rb', line 277 def templateId=(value) @templateId = value end |
#title ⇒ String
Returns a title for the PDF document.
126 127 128 |
# File 'lib/grabzit/pdfoptions.rb', line 126 def title @title end |
#title=(value) ⇒ void
This method returns an undefined value.
Set a title for the PDF document
134 135 136 |
# File 'lib/grabzit/pdfoptions.rb', line 134 def title=(value) @title = value end |
#waitForElement ⇒ String
Returns get the CSS selector of the HTML element in the web page that must be visible before the capture is performed.
334 335 336 |
# File 'lib/grabzit/pdfoptions.rb', line 334 def waitForElement @waitForElement end |
#waitForElement=(value) ⇒ void
This method returns an undefined value.
Set the CSS selector of the HTML element in the web page that must be visible before the capture is performed
342 343 344 |
# File 'lib/grabzit/pdfoptions.rb', line 342 def waitForElement=(value) @waitForElement = value end |