Solved

VB and nfop

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
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.
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…

932 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

10 Experts available now in Live!

Get 1:1 Help Now