unable to use DefaultFileName

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
GA_Desj
Posts: 3
Joined: Mon Nov 01 2010

unable to use DefaultFileName

Post by GA_Desj »

I use PDF converter 4.5.0.0 to convert crystal reports XI R2 SP4 report to pdf. However, I tried about everything to remove the pdf filename prompt and nothing worked. We use Visual FoxPro 8.0 to open the crystal report and print to pdf with amyuni. Here's a snippet of my code. Can anyone find the problem with it ? Thanks !!
BTW, I use Windows 7 Professional x64 (french) and Visual FoxPro is 32 bits version 8. I also have Caseware Tracker 2010 installed which use amyuni 4.0.0.7 pdf converter.

Code: Select all

loPdfprinter = createobject('CDIntfex.CDIntfex')
=loPdfprinter.DriverInit("Amyuni PDF Converter") 
=loPdfprinter.SetDefaultPrinter()
loPdfprinter.Lock("toto.pdf")

loPdfprinter.SetDocFileProps("toto.pdf", 3, "d:\temp", "d:\temp\toto.pdf")

loPdfprinter.PaperSize=5  && 8.5/14
loPdfprinter.ImageOptions=1  && remove duplicate image
loPdfprinter.FontEmbedding = .t.  && activer les fonts bold

temp = CREATEOBJECT("CrystalRuntime.Application")
rep = temp.OpenReport("D:\Systemes\Applic\ScsIwin\RAPPORTS\lettres2.rpt")

FOR i = 1 TO rep.Database.Tables.Count
	rep.Database.Tables(i).SetTableLocation(pt + lcdata(i) + ".dbf", lcdata(i), "")
ENDFOR

=rep.PrintOut(.f., 1)

loPdfprinter.Unlock("toto.pdf", 1000)
Even though I set FileNameOptions to 3, I always get a popup asking for the pdf name and directory with "Crystal Reports ActiveX Designer - .pdf" as the default name entered.
peterwegrzyn
Posts: 24
Joined: Tue Aug 19 2003

Re: unable to use DefaultFileName

Post by peterwegrzyn »

Is this forum actually supported? This post is over a week old..
GA_Desj
Posts: 3
Joined: Mon Nov 01 2010

Re: unable to use DefaultFileName

Post by GA_Desj »

I actually solved it myself by using the locking mechanism... Here is a snapshot of my code for those interested ... This code is in FoxPro but quite easy to figure it out ...

Code: Select all

** create pdf printer object
loPdfprinter = createobject('CDIntfex.CDIntfex.4.5') 
=loPdfprinter.DriverInit("Amyuni PDF Converter")
=loPdfprinter.SetDefaultPrinter()
** locking for specific file (I was never able to use GLock)
=loPdfprinter.Lock("Seagate Crystal Reports - " + SUBSTR(JUSTFNAME(lcReport),1,5))
lopdfprinter.SetDocFileProps("Seagate Crystal Reports - " + SUBSTR(JUSTFNAME(lcReport),1,5), 0x200203, JUSTPATH(lcPrinterPort), lcPrinterPort)

*** printing from crystal reports (code removed)***
	
lopdfPrinter.Unlock("Seagate Crystal Reports - " + SUBSTR(JUSTFNAME(lcReport),1,5), 1000)
loPdfprinter.RestoreDefaultPrinter()
loPdfprinter.DriverEnd()  && Ferme PDFPrinter
loPdfprinter = .null.  && Détruit l'instance
peterwegrzyn
Posts: 24
Joined: Tue Aug 19 2003

Re: unable to use DefaultFileName

Post by peterwegrzyn »

Note: I had issues with some configurations of VMWare, Using DefaultFile name didn't work. I had to rewrite it using SetDocFileProps.
Post Reply