Solved

VB and nfop

Posted on 2004-04-26
4
365 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
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
iclemartin earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
try adding

objInput.close()

after objFODriver.run()
0
 

Author Comment

by:Siberwulf
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

743 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now