Loading a stream in VB

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
Jeremy
Posts: 4
Joined: Wed May 26 2004

Loading a stream in VB

Post by Jeremy »

I have stored a pdf stream in memory using Converter and have the stream in a VB String, and now I want to be able to load the String into Creator within my VB6 application, so that I can modify it within memory without using any file I/O. I have only seen documentation to do this for C++ (pg. 34 of the Creator Devoloper Manual), and was wondering if there is an interface for this in Visual Basic 6. Also, the C++ documentation for this is very vague. Thanks for the help.

Jeremy
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hello,

To intercept the data stream you can follow the below steps:

1. Create a custom DLL following the framework described in our documentation and copy the DLL to the system or system32 directory.
2. Set the SendToCreator option in the FileNameOptions method or function call.
3. Set the "PageProcessor" parameter using SetPageProcessor method or function call. This parameter should be set to the name of the custom DLL and only when logged in as Administrator.

The dll needed to intercept datastream is a ACPgProc.dll. I am adding below a sample code that uses the PDF Converter ver2.10 and the ACPgProc.dll, this sample prints a Word doc and this Word doc will be previewed on the PDF Creator as it is being generated.

To successfully run this sample you need to have the PDF Creator product installed and opened. Also you will need to copy the ACPgProc.dll to your system directory (under 2000 it is :windows\system32 ).

You can find a detailed explanation of this feature by looking over pages 152 to 154 of the "Common Driver Interface210.pdf" that is shipped with the PDF Converter product.

Code: Select all

Private Sub cmdPrintSample_Click()
    
On Error GoTo printer_error
        ' attach to existing printer
        hPrinter = DriverInit(PrinterName)
        
        If hPrinter = 0 Then GoTo printer_error
        
        ' set output options
        SetFileNameOptions hPrinter, SendToCreator
        SetPageProcessor hPrinter, "ACPgProc.dll"
        
        ' Print a sample Word document
        Dim wordApp As New Word.Application
        Dim documents As Word.documents
        
        ' open a Word document in Read-only mode
        Set documents = wordApp.documents
        
        'change doc to point to a valid MsWord on your system
        documents.Open "c:\temp\sample.doc", False, True
        
        'Must enable the printer
        EnablePrinter hPrinter, strLicensTo, strActivationCode
        
        ' set the ActivePrinter to ours
        wordApp.ActivePrinter = PrinterName
        
        ' print the Word document without background printing
        wordApp.PrintOut False
        
        ' reset printer options
        SetFileNameOptions hPrinter, 0
        wordApp.Quit False
        Set documents = Nothing
        Set wordApp = Nothing
        Exit Sub
        
printer_error:
MsgBox "Sorry, could not find printer"

End Sub
Hope this helps.
Jeremy
Posts: 4
Joined: Wed May 26 2004

Post by Jeremy »

Hi, I was just wondering where I can get the ACPgProc.dll. It didn't come with the installation of the PDF Suite. Thanks.
Joan
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002
Contact:

Post by Joan »

Hi,

You can get the DLL from our Technical Support Department, please send us an e-mail to support@amyuni.com

Best Regards,
Post Reply