Solved

VB and nfop

Posted on 2004-04-26
4
374 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 500 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

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…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

732 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