module Asciidoctor::PdfCore::PdfObject

Public Instance Methods

str2pdfobj(string) click to toggle source

Convert the string to a PDF object, first attempting to convert it to a PDF literal string.

# File lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb, line 20
def str2pdfobj string
  ::PDF::Core::PdfObject(str2pdfval string)
end
str2pdfval(string) click to toggle source

Convert the string to a PDF literal string if it can be encoded as ASCII-8BIT. Otherwise, return the specified string.

# File lib/asciidoctor-pdf/pdf_core_ext/pdf_object.rb, line 8
def str2pdfval string
  if string && string.ascii_only?
    ::PDF::Core::LiteralString.new(string.encode ::Encoding::ASCII_8BIT)
  else
    string
  end
end