See LICENCE in the main distribution # for full licensing information. # /projects/ruby-pdf/ # Copyright 2003 - 2005 Austin Ziegler. PDF::Writer requires Ruby 1.8.2 or better, Color 1.4.0 or better, and Transaction::Simple 1.3.0 or better. Please read the file LICENCE for licensing restrictions on this library, as well as important patent considerations. This and earlier editions are available from Adobe's PDF developer website. This software is based on Adobe's PDF Reference, Fifth Edition, version 1.6. The canonical documentation for PDF::Writer is "manual.pdf", which can be generated using bin/techbook (just "techbook" for RubyGem users) and the manual file "d". There are several demo programs available in the demo/ directory. The canonical documentation for PDF::Writer is 'manual.pdf', which can be generated using bin/techbook (just 'techbook' for RubyGem users) and the manual file 'manual. Simple array: req = %w req # => "bar, baz, bat" req.This library provides the ability to create PDF documents using only native Ruby libraries. This library provides the ability to create PDF documents using only native Ruby libraries. Add this Sub Header to the document object, as shown in Figure 5. Creating a Sub Header Create a Sub Header with text alignment center and set the font size to 15. Figure 4 is the image of a PDF document with header text. Symbol: req = :text # => :text req # => "text" req. Run the program and go to the path specified in PdfWriter and open the PDF document. String: req = 'text/html' # => "text/html" req # => "text/html" req. =: Sets the value for the given key the given value may be a string, a symbol, an array, or a hash.Īdd_field: Adds a given value to a value for the given key (not overwriting the existing value).ĭelete: Deletes the field for the given key. : Returns the string value for the given key, or nil if it does not exist.įetch: Like, but accepts a default value to be returned if the key does not exist. These methods return field values as string the string value for a field is equivalent to self.join(', ')): To_hash: Returns a hash of all header fields: each key is a field name its value is the array value for the field. Get_fields: Returns the array value for the given key, or nil if it does not exist. These methods return field values as arrays: Req # => "*/*" req # => "*/*" req # => "*/*" req = 'text/html' req = 'text/html' req = 'text/html' Field Values ¶ ↑Ī field value may be returned as an array of strings or as a string: Field Keys ¶ ↑Ī string: Key 'Accept' is treated as if it were 'Accept'.downcase i.e., 'accept'.Ī symbol: Key :Accept is treated as if it were :Accept.to_s.downcase i.e., 'accept'.Įxamples: req = Net :: HTTP :: Get. path = '/todos/1' Fields ¶ ↑Ī header field is a key/value pair. get( '/todos/1')Īn example that needs a modified URI first duplicates uri, then modifies the duplicate: _uri = uri. So that example requests may be written as: Net :: HTTP. Some examples also assume these variables: uri = URI( '') Many code examples here use these example websites: Fields may be retrieved from the object see Getters and Iterators.Įxactly which fields should be sent or expected depends on the host see:Įxamples here assume that net/http has been required (which also requires uri): require 'net/http' Any fields may be defined in the request see Setters.Ī Net::HTTPResponse object: the objects headers are usually those returned from the host. Request and Response Fields ¶ ↑Ī Net::HTTPRequest object: the object’s headers will be sent with the request. The headers are a hash-like collection of key/value pairs called fields. Net::HTTPGenericRequest (and therefore Net::HTTPRequest). The HTTPHeader module provides access to HTTP headers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |