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.
-
#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.
-
#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.
-
#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 |
# 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 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.
426 427 428 |
# File 'lib/grabzit/pdfoptions.rb', line 426 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.
434 435 436 |
# File 'lib/grabzit/pdfoptions.rb', line 434 def add_template_parameter(name, value) @templateVariables = appendParameter(@templateVariables, name, value) end |
#address ⇒ String
Returns get the URL to execute the HTML code in.
396 397 398 |
# File 'lib/grabzit/pdfoptions.rb', line 396 def address @address end |
#address=(value) ⇒ void
This method returns an undefined value.
Set the URL to execute the HTML code in
404 405 406 |
# File 'lib/grabzit/pdfoptions.rb', line 404 def address=(value) @address = value end |
#browserWidth ⇒ Integer
Returns the width of the browser in pixels.
201 202 203 |
# File 'lib/grabzit/pdfoptions.rb', line 201 def browserWidth @browserWidth end |
#browserWidth=(value) ⇒ void
This method returns an undefined value.
Set the width of the browser in pixels
209 210 211 |
# File 'lib/grabzit/pdfoptions.rb', line 209 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.
344 345 346 |
# File 'lib/grabzit/pdfoptions.rb', line 344 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
352 353 354 |
# File 'lib/grabzit/pdfoptions.rb', line 352 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.
136 137 138 |
# File 'lib/grabzit/pdfoptions.rb', line 136 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
144 145 146 |
# File 'lib/grabzit/pdfoptions.rb', line 144 def coverURL=(value) @coverURL = value end |
#cssMediaType ⇒ String
Returns the CSS Media Type of the PDF to be returned.
83 84 85 |
# File 'lib/grabzit/pdfoptions.rb', line 83 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’
91 92 93 94 |
# File 'lib/grabzit/pdfoptions.rb', line 91 def cssMediaType=(value) value = GrabzIt::Utility.nil_check(value).capitalize @cssMediaType = value end |
#customWaterMarkId ⇒ String
Returns the custom watermark id.
279 280 281 |
# File 'lib/grabzit/pdfoptions.rb', line 279 def customWaterMarkId @customWaterMarkId end |
#customWaterMarkId=(value) ⇒ void
This method returns an undefined value.
Set a custom watermark to add to the PDF.
287 288 289 |
# File 'lib/grabzit/pdfoptions.rb', line 287 def customWaterMarkId=(value) @customWaterMarkId = value end |
#delay ⇒ Integer
Returns the number of milliseconds to wait before creating the capture.
240 241 242 |
# File 'lib/grabzit/pdfoptions.rb', line 240 def delay @delay end |
#delay=(value) ⇒ void
This method returns an undefined value.
Set the number of milliseconds to wait before creating the capture
248 249 250 |
# File 'lib/grabzit/pdfoptions.rb', line 248 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.
318 319 320 |
# File 'lib/grabzit/pdfoptions.rb', line 318 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
326 327 328 |
# File 'lib/grabzit/pdfoptions.rb', line 326 def hideElement=(value) @hideElement = value end |
#includeBackground ⇒ Boolean
Returns true if the background of the web page should be included in the PDF.
42 43 44 |
# File 'lib/grabzit/pdfoptions.rb', line 42 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
50 51 52 |
# File 'lib/grabzit/pdfoptions.rb', line 50 def includeBackground=(value) @includeBackground = value end |
#includeLinks ⇒ Boolean
Returns true if the links should be included in the PDF.
97 98 99 |
# File 'lib/grabzit/pdfoptions.rb', line 97 def includeLinks @includeLinks end |
#includeLinks=(value) ⇒ void
This method returns an undefined value.
Set to true if links should be included in the PDF
105 106 107 |
# File 'lib/grabzit/pdfoptions.rb', line 105 def includeLinks=(value) @includeLinks = value end |
#includeOutline ⇒ Boolean
Returns true if the PDF outline should be included.
110 111 112 |
# File 'lib/grabzit/pdfoptions.rb', line 110 def includeOutline @includeOutline end |
#includeOutline=(value) ⇒ void
This method returns an undefined value.
Set to true if the PDF outline should be included
118 119 120 |
# File 'lib/grabzit/pdfoptions.rb', line 118 def includeOutline=(value) @includeOutline = value end |
#marginBottom ⇒ Integer
Returns the margin that should appear at the bottom of the PDF document page.
175 176 177 |
# File 'lib/grabzit/pdfoptions.rb', line 175 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
183 184 185 |
# File 'lib/grabzit/pdfoptions.rb', line 183 def marginBottom=(value) @marginBottom = value end |
#marginLeft ⇒ Integer
Returns the margin that should appear at the left of the PDF document page.
162 163 164 |
# File 'lib/grabzit/pdfoptions.rb', line 162 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
170 171 172 |
# File 'lib/grabzit/pdfoptions.rb', line 170 def marginLeft=(value) @marginLeft = value end |
#marginRight ⇒ Integer
Returns the margin that should appear at the right of the PDF document.
188 189 190 |
# File 'lib/grabzit/pdfoptions.rb', line 188 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
196 197 198 |
# File 'lib/grabzit/pdfoptions.rb', line 196 def marginRight=(value) @marginRight = value end |
#marginTop ⇒ Integer
Returns the margin that should appear at the top of the PDF document page.
149 150 151 |
# File 'lib/grabzit/pdfoptions.rb', line 149 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
157 158 159 |
# File 'lib/grabzit/pdfoptions.rb', line 157 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.
357 358 359 |
# File 'lib/grabzit/pdfoptions.rb', line 357 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
365 366 367 |
# File 'lib/grabzit/pdfoptions.rb', line 365 def mergeId=(value) @mergeId = value end |
#noAds ⇒ Boolean
Returns get if adverts should be automatically hidden.
370 371 372 |
# File 'lib/grabzit/pdfoptions.rb', line 370 def noAds @noAds end |
#noAds=(value) ⇒ void
This method returns an undefined value.
Set to true if adverts should be automatically hidden
378 379 380 |
# File 'lib/grabzit/pdfoptions.rb', line 378 def noAds=(value) @noAds = value end |
#noCookieNotifications ⇒ Boolean
Returns get if cookie notifications should be automatically hidden.
383 384 385 |
# File 'lib/grabzit/pdfoptions.rb', line 383 def noCookieNotifications @noCookieNotifications end |
#noCookieNotifications=(value) ⇒ void
This method returns an undefined value.
Set to true if cookie notifications should be automatically hidden
391 392 393 |
# File 'lib/grabzit/pdfoptions.rb', line 391 def noCookieNotifications=(value) @noCookieNotifications = value end |
#orientation ⇒ String
Returns the orientation of the PDF to be returned.
69 70 71 |
# File 'lib/grabzit/pdfoptions.rb', line 69 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’
77 78 79 80 |
# File 'lib/grabzit/pdfoptions.rb', line 77 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.
227 228 229 |
# File 'lib/grabzit/pdfoptions.rb', line 227 def pageHeight @height end |
#pageHeight=(value) ⇒ void
This method returns an undefined value.
Set the page height of the resulting PDF in mm
235 236 237 |
# File 'lib/grabzit/pdfoptions.rb', line 235 def pageHeight=(value) @height = value end |
#pagesize ⇒ String
Returns the page size of the PDF to be returned.
55 56 57 |
# File 'lib/grabzit/pdfoptions.rb', line 55 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’
63 64 65 66 |
# File 'lib/grabzit/pdfoptions.rb', line 63 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.
214 215 216 |
# File 'lib/grabzit/pdfoptions.rb', line 214 def pageWidth @width end |
#pageWidth=(value) ⇒ void
This method returns an undefined value.
Set the page width of the resulting PDF in mm
222 223 224 |
# File 'lib/grabzit/pdfoptions.rb', line 222 def pageWidth=(value) @width = value end |
#password ⇒ String
Returns get the password that protects the PDF document.
409 410 411 |
# File 'lib/grabzit/pdfoptions.rb', line 409 def password @password end |
#password=(value) ⇒ void
This method returns an undefined value.
Set the password that protects the PDF document
417 418 419 |
# File 'lib/grabzit/pdfoptions.rb', line 417 def password=(value) @password = value end |
#quality ⇒ Integer
Returns the quality of the PDF.
292 293 294 |
# File 'lib/grabzit/pdfoptions.rb', line 292 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
300 301 302 |
# File 'lib/grabzit/pdfoptions.rb', line 300 def quality=(value) @quality = value end |
#requestAs ⇒ Integer
Returns get which user agent type should be used.
253 254 255 |
# File 'lib/grabzit/pdfoptions.rb', line 253 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
261 262 263 |
# File 'lib/grabzit/pdfoptions.rb', line 261 def requestAs=(value) @requestAs = value end |
#targetElement ⇒ String
Returns get the CSS selector of the only HTML element in the web page to capture.
305 306 307 |
# File 'lib/grabzit/pdfoptions.rb', line 305 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
313 314 315 |
# File 'lib/grabzit/pdfoptions.rb', line 313 def targetElement=(value) @targetElement = value end |
#templateId ⇒ String
Returns the template ID that specifies the header and footer of the PDF document.
266 267 268 |
# File 'lib/grabzit/pdfoptions.rb', line 266 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
274 275 276 |
# File 'lib/grabzit/pdfoptions.rb', line 274 def templateId=(value) @templateId = value end |
#title ⇒ String
Returns a title for the PDF document.
123 124 125 |
# File 'lib/grabzit/pdfoptions.rb', line 123 def title @title end |
#title=(value) ⇒ void
This method returns an undefined value.
Set a title for the PDF document
131 132 133 |
# File 'lib/grabzit/pdfoptions.rb', line 131 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.
331 332 333 |
# File 'lib/grabzit/pdfoptions.rb', line 331 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
339 340 341 |
# File 'lib/grabzit/pdfoptions.rb', line 339 def waitForElement=(value) @waitForElement = value end |