Hello Jose,
Thank you very much for you kind help. Your Last mail was very helpful to me.
but I got error at printing and saving of document.
I giving my printing function to you for simulation of amyuni problem which I getting.
Code: Select all
01Private Sub PrintToPrinter(p_lngStartPgNo As Long, p_lngEndPgNo As Long, p_strPrintOption as String)
02
03 Dim l_lng As Long
04 Dim l_cdi As New CDIntfEx.CDIntfEx
05 Dim l_strPrinterName As String
06
07
08 ' - - - THIS CONDITION IS FOR THE PRINTING TO PHYSICAL PRINTER.
09 If InStr(1, "0145", p_strPrintOption) > 0 Then
10
11 ' - - - STARTING THE PRINTING TO PRINTER HERE PRINTER DIALOG BOX WILL DISPLAY.
12 pdfView.StartPrint "", 1
13 For l_lng = p_lngStartPgNo To p_lngEndPgNo
14 pdfView.PrintPage l_lng
15 Next
16 pdfView.EndPrint
17 ' - - -
18
19 End If
20
21 ' - - - THIS CONDITION IS FOR THE PRINTING THROUGH LOGICAL PRINTER IN FILE.
22 If InStr(1, "2345", p_strPrintOption) > 0 Then
23 ' - - - THIS CREATE A NEW AMYUNI PRINTER FOR OUR PRINTING.
24
25 ' THIS IS OUR PRINTER NAME.
26 l_strPrinterName = "TymSphere Printer"
27 l_lng = l_cdi.PDFDriverInit(l_strPrinterName)
28 l_cdi.SetDefaultPrinter
29 With l_cdi
30
31 .FontEmbedding = True ' EMBED TRUETYPE FONTS WITH THE DOCUMENTS.
32 .JPEGCompression = True ' ACTIVATE JPEG COMPRESSION.
33 .JPegLevel = 3 ' LOW QUALITY BUT HIGH COMPRESSION LEVEL.
34 .SetDefaultConfig ' MAKE THE VALUES DEFUALTS.
35
36 End With
37 ' - - -
38 ' THIS IS NEW FILE NAME WITH PATH FOR THE CONTACT
39 pdfView.Refresh
40 pdfView.StartPrint l_strPrinterName, 1
41 pdfView.PrintToFileName = App.Path & "\Test.tsp"
42 '- - - STARTING THE PRINTING IN THE FILE ON SPECIFIED PATH WITH NAME.
43 For l_lng = p_lngStartPgNo To p_lngEndPgNo
44 pdfView.CurrentPage = l_lng
45 pdfView.PrintPage l_lng
46 Next
47 pdfView.EndPrint
48 ' - - -
49 End If
50
51 l_cdi.RestoreDefaultPrinter
52 Set l_cdi = Nothing
53
54End Sub
[/color]Inthis Code I am printing the document into the file and printer (both)
01 ) Here I getting error on line 45
ie.
Run-time error '-2147467259(80004005)
Method 'PrintPage' of object 'IPDFCreativeX' failed
02) after execution of line 12 printer dialog box appears properly
then if I press Cancel button at that time error occurs
Run-time error '-2147467259(80004005)
Method 'StartPrint' of object 'IPDFCreativeX' failed
I tried after giving "Amyuni Converter Printer 2.10" name instead of
new printer ie. l_strPrinterName on line 40 but same error occures.
ie.
40 pdfView.StartPrint "Amyuni Converter Printer 2.10", 1
Questions :
01 How I can get the Printer Name Form Printer Folder which have amyuni printer model. ?
I know after installation amyuni install printer named "Amyuni Converter Printer" but
anyone can change printer name. I have created new printer by object because we will
not install amyuni at client side ?
02 How I can overcome from this above problem. is there some thing wrong ?
03 Is there any function to overcome error which occures after pressing cancel button
of the printer dailog box. ?
Thanking You
Kamlesh Gujarathi
-----------------------------
kamlesh@itshastra.com