01.
02.
03.
04.
05.
06.
07.
08.
09.
10.
11.
12.
13.
14.
15.
16.
Private
Sub
PrintAdobePDFToJPEG(
ByVal
strFilePath
As
String
)
17.
18.
Dim
objAdobeApp
As
Object
19.
Dim
itfAVDocument
As
Object
20.
Dim
itfPDDocument
As
Object
21.
Dim
nPages
As
Long
22.
23.
Dim
objUDC
As
UDC.IUDC
24.
Dim
itfPrinter
As
UDC.IUDCPrinter
25.
Dim
itfProfile
As
UDC.IProfile
26.
27.
Dim
AppDataPath
As
String
28.
Dim
ProfilePath
As
String
29.
30.
31.
objUDC =
New
UDC.APIWrapper
32.
itfPrinter = objUDC.Printers(
"Universal Document Converter"
)
33.
itfProfile = itfPrinter.Profile
34.
35.
36.
objUDC.DefaultPrinter =
"Universal Document Converter"
37.
38.
39.
40.
41.
AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
42.
ProfilePath = Path.Combine(AppDataPath,
"UDC Profiles\PDF to JPEG.xml"
)
43.
itfProfile.Load(ProfilePath)
44.
45.
itfProfile.OutputLocation.Mode = UDC.LocationModeID.LM_PREDEFINED
46.
itfProfile.OutputLocation.FolderPath =
"C:\Out"
47.
48.
itfProfile.PostProcessing.Mode = UDC.PostProcessingModeID.PP_OPEN_FOLDER
49.
50.
51.
On
Error
Resume
Next
52.
objAdobeApp = CreateObject(
"AcroExch.App"
)
53.
itfAVDocument = CreateObject(
"AcroExch.AVDoc"
)
54.
55.
56.
If
itfAVDocument.Open(strFilePath,
""
) =
True
Then
57.
58.
itfPDDocument = itfAVDocument.GetPDDoc()
59.
nPages = itfPDDocument.GetNumPages()
60.
61.
62.
Call
itfAVDocument.PrintPagesSilent(0, nPages - 1, 0,
True
,
True
)
63.
64.
65.
Call
itfAVDocument.Close(
True
)
66.
itfAVDocument =
Nothing
67.
itfPDDocument =
Nothing
68.
69.
End
If
70.
71.
72.
Call
objAdobeApp.
Exit
()
73.
objAdobeApp =
Nothing
74.
75.
End
Sub