VB: Win98 problem with CDIntfEx.Document.Open

The Amyuni PDF Converter is our Printer Driver that enables you to convert any documents to PDF format. If you have any questions about installing and using the Amyuni PDF Converter please post them here.
Post Reply
rushing
Posts: 13
Joined: Wed Sep 10 2003

VB: Win98 problem with CDIntfEx.Document.Open

Post by rushing »

The code below works fine for Windows 2000 machines, but on a Win98 and a Win95 machine, the code fails when on the cdiDoc.Open line. I'm rather new to PDF Converter, so I may be missing something.

Code: Select all

Public Sub PDFPrint(strFileName As String)
On Error GoTo FAILURE
Dim cdi As CDIntfEx.CDIntfEx
Dim cdiDoc As New CDIntfEx.Document

Set cdi = ProductionReport.CDIPrint


cdi.SetDefaultPrinter


cdi.FileNameOptionsEx = 1 + 2 ' NoPrompt + UseFileName
cdi.DefaultFileName = strFileName ' set output file name

cdi.EnablePrinter "Our Company", "DEADBEEF"

strErrorLocation = "printRRForm "
printRRForm AdditionalMessage:=dlgEmailSetup.EmailParam(PDFAdditionalComment).Text, _
             PrintingToPDF:=True


cdi.RestoreDefaultPrinter

'CODE FAILS ON LINE BELOW ON WIN95 machine
cdiDoc.Open strFileName

cdiDoc.SetLicenseKey "Our Company", "DEADBEEF"

cdiDoc.Encrypt "superSecretPWord", "", -64 + 4 + 16 + 32

cdiDoc.Save strFileName

Set cdiDoc = Nothing
Set cdi = Nothing

Exit Sub
FAILURE:
    Err.Raise Err.Number, "PDFPrint", "PDFPrint: " & _ 
              Err.Description & " " & strErrorLocation

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

Post by Joan »

Hello,

How are you declaring "strFileName"

Maybe strFileName is not computed properly under Windows 95 / 98, please try to declare strFileName to a fix path on the system like: "c:\test.pdf"

Also please check that the path you are specifying exists effectively on the machines running under Windows 95 / 98.


Hope this helps 8)
rushing
Posts: 13
Joined: Wed Sep 10 2003

Post by rushing »

Actually, the code above was properly creating the file. It was when I tried to open it using "cdiDoc.Open strFileName " that it failed.

I did get it to work, though I suspect there may be a problem with the open method under certain circumstances. In my PrintRR call, I was not explicitly declaring a font. On the various Win2K machines I was using, it was defaulting to Arial. For some reason that I have not taken the time to investigate, the Win95 machine is defaulting to a custom-installed art-deco font called "TheBeesKnees," but this font was not being embedded in the PDF.

After I changed my code to explicitly set the font to Arial in my PrintRR procedure, the code sample above worked flawlessly on the Win95 machine. So, I suspect there was something about the format of the PDF using "TheBeesKnees" that caused cdiDoc.Open to fail. I have not tested taking the PDF produced on the Win95 machine and opening it on a Win2K machine.
Post Reply