?
Solved

VB and nfop

Posted on 2004-04-26
4
Medium Priority
?
376 Views
Last Modified: 2008-02-01
I'm trying to convert FO files to PDF using nfop.

This is the code I have already:

----------------------------------------
Dim objFODriver As New Driver

Dim strmFOutput As New java.io.FileOutputStream("c:\test.pdf")
objFODriver.setOutputStream(strmFOutput)

(2)Dim objXMLReader As org.xml.sax.XMLReader

Dim objInputSource As New org.xml.sax.InputSource

Dim objInput As java.io.InputStream

objInput = New java.io.FileInputStream("c:\test.fo")

objInputSource.setByteStream(objInput)

(1)objXMLReader.parse(objInputSource)

objFODriver.render(objXMLReader, objInputSource)
----------------------------------------

I'm getting a "object not instantiated" error on (1).  I don't know how to fix it really, since I can't use "New" on an interface (XMLReader) (2).
0
Comment
Question by:Siberwulf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
iclemartin earned 1500 total points
ID: 10922870
Check out this article:
http://www.techheadbrothers.com/DesktopDefault.aspx?tabindex=1&tabid=7&AId=20

The text is in French, but the code is very legible although C#.
0
 

Author Comment

by:Siberwulf
ID: 10922981
I read that, but its a bit more elaborate than I need.  This is the new code I've come up with.  Problem is, the PDF file is in use even when the sub ends.  When I close the program, it is then accessible.  Any ideas?

        Dim strmFOutput As New java.io.FileOutputStream("c:\test.pdf")

        Dim objInputSource As New org.xml.sax.InputSource

        Dim objInput As java.io.InputStream

        objInput = New java.io.FileInputStream("c:\test.fo")

        objInputSource.setByteStream(objInput)

        Dim objFODriver As New Driver(objInputSource, strmFOutput)

        objFODriver.run()
0
 
LVL 1

Expert Comment

by:iclemartin
ID: 10923025
try adding

objInput.close()

after objFODriver.run()
0
 

Author Comment

by:Siberwulf
ID: 10923031
Just added strmFOutput .close()

Been a long day looking at the code and I'm missing stupdi stuff now.  Thanks for all your help though!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month9 days, 20 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question