Solved

VB and nfop

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel VBA, find a string in a column, update a cell 7 86
Access Object Property from VBA Module in Excel 2010 2 37
Hide vba in gp 7 104
Add and format columns in vb6 7 63
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
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…

861 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