backend/lib/AS_fop.rb
def to_pdf
    begin
      fo = StringIO.new(to_fo).to_inputstream
      fopfac = FopFactory.newInstance
      fopfac.setBaseURL( File.join(ASUtils.find_base_directory, 'stylesheets') )
      fop = fopfac.newFop(MimeConstants::MIME_PDF, @output.to_outputstream)
      transformer = TransformerFactory.newInstance.newTransformer()
      res = SAXResult.new(fop.getDefaultHandler)
      transformer.transform(StreamSource.new(fo), res)
    ensure
     @output.close
    end
    @output
  end
# returns a temp file with the converted PDF
returns a temp file with the converted PDF
returns a temp file with the converted PDF
def to_pdf
    begin
      fo = StringIO.new(to_fo).to_inputstream
      fopfac = FopFactory.newInstance
      fopfac.setBaseURL( File.join(ASUtils.find_base_directory, 'stylesheets') )
      fop = fopfac.newFop(MimeConstants::MIME_PDF, @output.to_outputstream)
      transformer = TransformerFactory.newInstance.newTransformer()
      res = SAXResult.new(fop.getDefaultHandler)
      transformer.transform(StreamSource.new(fo), res)
    ensure
     @output.close
    end
    @output
  end
def to_pdf begin fo = StringIO . new ( to_fo ) . to_inputstream fopfac = FopFactory . newInstance fopfac . setBaseURL ( File . join ( ASUtils . find_base_directory , 'stylesheets' ) ) fop = fopfac . newFop ( MimeConstants :: MIME_PDF , @output . to_outputstream ) transformer = TransformerFactory . newInstance . newTransformer ( ) res = SAXResult . new ( fop . getDefaultHandler ) transformer . transform ( StreamSource . new ( fo ) , res ) ensure @output . close end @output end
returns a temp file with the converted PDF
returns a temp file with the converted PDF