Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adobe SDK

Status
Not open for further replies.

Swi

Programmer
Feb 4, 2002
1,963
US
Has anyone ever used the Adobe SDK to pull a list of all colors used in a PDF?

I've pulled text from, pulled size from, added pages to, deleted pages, etc... from a PDF using the SDK however I have not located anything to do this.

Any help would be greatly appreciated.

Thanks.

Swi
 
Hi,

I did quite a bit of research and found this solution to give me all kinds of information on the PDF.

magick identify -verbose C:\Swiler\Test-Output.pdf > C:\Swiler\TestColor.txt

When I run this from a command line it seems to be getting me the information I need.

Any ideas of how to best execute this in VB6 and place all information into a variable?

Thanks.

Swi
 
Did you try Shell or ShellExecute ?

And since you can save your info into a text file, just read that file into a variable

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
I have but no luck. It literally just opens the cmd window.

Code:
shell "cmd.exe magick identify -verbose C:\Swiler\Test-Output.pdf > C:\Swiler\Test-Output2.txt", vbNormalFocus

And yes, I'll use FSO or something else to read the text file into a variable. I was not sure if there was a way to directly put the results into a variable.

Swi
 
Based on this post, you may just need:
[tt]
Call Shell("magick identify -verbose C:\Swiler\Test-Output.pdf > C:\Swiler\TestColor.txt")[/tt]

I do not have [tt]magick[/tt] installed so I cannot test it :-(

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
Hi,

Thanks for the response. I tried the code above and it said file not found so I added the full path.

Code:
Call shell(Chr(34) & "C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick" & Chr(34) & " identify -verbose C:\Swiler\Test-Output.pdf > C:\Swiler\TestColor.txt", vbNormalFocus)

It acts like it runs and prompt even shows the information in the cmd window but it is not output to the text file. Close but no luck yet.

Swi
 
Hoping someone has a more eloquent solution but this does work for me.

1. Created a batch file - "C:\Program Files\ImageMagick-7.1.0-Q16-HDRI\magick.exe" identify -verbose C:\Swiler\Test-Output.pdf > C:\Swiler\TestColor.txt
2. Created a quick VB6 app that will call the BAT file
Code:
Dim wsh As Object
Set wsh = VBA.CreateObject("WScript.Shell")
Dim waitOnReturn As Boolean: waitOnReturn = True
Dim windowStyle As Integer: windowStyle = 1
Dim errorCode As Integer
wsh.Run "C:\Users\swiler.delp\Desktop\Test.bat", windowStyle, waitOnReturn
MsgBox "Done!", vbInformation + vbOKOnly
3. Will create the Batch file dynamically and then call it via the code

Just not sure why the original Shell code above does not seem to work. Maybe I am missing something simple.

Thanks.

Swi
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top