Automating Acrobat PDF to JPG conversion via COM ?

  • Follow


Is there a way to automate (from Visual Basic) Acrobat converting a PDF to 
JPG format?  If not, any recommendations for third party tools would be 
appreciated!  (would like to avoid calling a command line from the 
application if possible)

Thanks.

-- Paul



0
Reply Paul 8/12/2005 6:22:52 PM

"Paul" <paule-nospam@mindspring.com> wrote in message
news:11fpq86i78c9n7e@news.supernews.com...
> Is there a way to automate (from Visual Basic) Acrobat converting a PDF to
> JPG format?  If not, any recommendations for third party tools would be
> appreciated!  (would like to avoid calling a command line from the
> application if possible)

Netpbm, http://netpbm.sourceforge.net, may be helpful to you. Look for
pstopnm and pnmtojpeg, both of which are available for Windows. Using these,
you should be able to write a script that would print a PDF to a Postscript
printer (saving as a .ps file), followed by use of pstopnm and pnmtojpeg to
complete the conversion.

Good luck.
--
Bill Segraves


0
Reply Bill 8/13/2005 3:37:14 AM


"Bill Segraves" <segraves_f13@mindspring.com> wrote in
news:KVdLe.4956$Je.62@newsread2.news.atl.earthlink.net: 
> "Paul" <paule-nospam@mindspring.com> wrote in message
> news:11fpq86i78c9n7e@news.supernews.com...
>> Is there a way to automate (from Visual Basic) Acrobat converting a
>> PDF to JPG format?  If not, any recommendations for third party tools
>> would be appreciated!  (would like to avoid calling a command line
>> from the application if possible)
> 
> Netpbm, http://netpbm.sourceforge.net, may be helpful to you. Look for
> pstopnm and pnmtojpeg, both of which are available for Windows. Using
> these, you should be able to write a script that would print a PDF to
> a Postscript printer (saving as a .ps file), followed by use of
> pstopnm and pnmtojpeg to complete the conversion.

This looks like a lot of command line calls. If they are allowed, using 
Ghostscript would be easiest. With it, not even Acrobat would be needed.

-- 
Matti Vuori, <http://sivut.koti.soon.fi/mvuori/index-e.htm>

0
Reply Matti 8/13/2005 9:13:08 AM

"Matti Vuori" <mvuori@koti.soon.fi> wrote in message
news:Xns96B17C50D88CBmvuorikotisoonfi@193.229.0.31...
> "Bill Segraves" <segraves_f13@mindspring.com> wrote in
> news:KVdLe.4956$Je.62@newsread2.news.atl.earthlink.net:
> > "Paul" <paule-nospam@mindspring.com> wrote in message
> > news:11fpq86i78c9n7e@news.supernews.com...
> >> Is there a way to automate (from Visual Basic) Acrobat converting a
> >> PDF to JPG format?  If not, any recommendations for third party tools
> >> would be appreciated!  (would like to avoid calling a command line
> >> from the application if possible)
> >
> > Netpbm, http://netpbm.sourceforge.net, may be helpful to you. Look for
> > pstopnm and pnmtojpeg, both of which are available for Windows. Using
> > these, you should be able to write a script that would print a PDF to
> > a Postscript printer (saving as a .ps file), followed by use of
> > pstopnm and pnmtojpeg to complete the conversion.
>
> This looks like a lot of command line calls. If they are allowed, using
> Ghostscript would be easiest. With it, not even Acrobat would be needed.

I agree, Matti. OTOH, a Google search with "Ghostscript pdftops" give a
number of interesting links, some of which suggest using Xpdf istead of
Ghostscript.

Xpdf, http://www.foolabs.com/xpdf/download.html, appears to have a
pre-compiled binary for pdftops, with which the OP should be able to avoid
the use of Acrobat in the process.

So, pdftops (from Xpdf), followed by pstopnm and pnmtojpeg (from Netpbm)
ought to do the trick. ISTM this would be easier than trying to automate the
process with Acrobat.

Cheers.
--
Bill Segraves


0
Reply Bill 8/13/2005 6:18:06 PM

"... ISTM this would be easier than trying to automate the
process with Acrobat..."

Mmmmh. You need only to open and save it as with Acrobat. 

Reinhard

0
Reply ReFOB 8/13/2005 9:24:55 PM

"ReFOB" <ReFOB@web.de> wrote in message
news:1123968295.265574.147140@f14g2000cwb.googlegroups.com...
> "... ISTM this would be easier than trying to automate the
> process with Acrobat..."
>
> Mmmmh. You need only to open and save it as with Acrobat.

AFAICT, not with Acrobat 3 or 4. For what version(s) of Acrobat (Reader) is
the user able to save as JPEG?

Your suggestion seems to be aimed at a one-at-a-time conversion, while the
other approaches suggested would lend themselves to batch conversion.

Clearly, Matti and I were thinking of (free) approaches that would not
require the OP to use Acrobat.

An example of the simplicity of the use of Netpbm (from the User Manual,
http://netpbm.sourceforge.net/doc/):

*****
Here is an example of a shell command to convert all your of PNG files
(named *.png) to JPEG files named *.jpg:

for i in *.png; do pngtopnm $i | ppmtojpeg >`basename $i .png`.jpg; done
*****

Similarly, for PDF conversion to JPEG (not tested):

for i in *.pdf; do pdftops $i | pstopnm | pnmtojpeg >`basename $i .pdf`.jpg;
done

where pdftops is from Xpdf and the other conversions are part of Netpbm.

I doubt that (batch) automation of whatever conversions are supported by a
particular version of Acrobat would be as simple as this.

Cheers.
--
Bill Segraves





0
Reply Bill 8/14/2005 6:40:23 PM

"... AFAICT, not with Acrobat 3 or 4..."
Must have been before my time.

"...For what version(s) of Acrobat (Reader) is
the user able to save as JPEG? .... "
Acrobat Reader ??? Would you try to save Doc as Rtf with a Word viewer?

With Acrobat5 I would have to thing about it. With Acrobat v6 or higher
you can save PDF as JPG (Tif, Rtf ...) direct by code.
Yes, Acrobat is not a command-line tool, so I think it need few lines
more of code, but you save extra installing and extra learning.

Bill, don't understand me wrong. I like freeware solutions but the
question was: " ... automate (from Visual Basic) Acrobat converting a
PDF to JPG format?  If not ....". So my answer goes to the first part
and completed the given answers. 

Best regards, Reinhard

0
Reply ReFOB 8/14/2005 11:39:35 PM

"ReFOB" <ReFOB@web.de> wrote in message
news:1124062775.699013.100570@g47g2000cwa.googlegroups.com...
<snip>
> "...For what version(s) of Acrobat (Reader) is
> the user able to save as JPEG? .... "
> Acrobat Reader ???

Oops! I meant to type "(or Reader)". I expected you might know which
versions of Acrobat or Reader support saving as JPEG.

> Would you try to save Doc as Rtf with a Word viewer?
>

No.

> With Acrobat5 I would have to thing about it. With Acrobat v6 or higher
> you can save PDF as JPG (Tif, Rtf ...) direct by code.

Thanks. Do you mean that, in Acrobat v6 or higher, the "Save As" dialog
offers JPG as a file format in which the file would be saved? If this is so,
the OP might try automating the conversion via OLE. Google and Google Groups
searches with "Acrobat OLE Automation" should give the OP many links to
helpful information. Since Acrobat includes an OLE server, this might be a
promising approach to the solution the OP requested.

> Yes, Acrobat is not a command-line tool, so I think it need few lines
> more of code, but you save extra installing and extra learning.
>

I agree, assuming the OP has a version of Acrobat that can save as JPG.
OTOH, he'll still need to learn how to run Acrobat via OLE. I would have
tried to show the OP how to do what he requested; except I don't currently
have Acrobat 5, 6, or 7 installed on any of my workstations.

> Bill, don't understand me wrong. I like freeware solutions but the
> question was: " ... automate (from Visual Basic) Acrobat converting a
> PDF to JPG format?  If not ....". So my answer goes to the first part
> and completed the given answers.
>

No problem here. I understand you now.

I see. My earlier responses were aimed at  the "If not ..." part, e.g.,
alternative solutions, as requested by the OP, and as suggested by Matti V.

> Best regards, Reinhard
>

Best regards to you, too, Reinhard.
--
Bill Segraves




0
Reply Bill 8/15/2005 12:11:25 AM

"Bill Segraves" <segraves_f13@mindspring.com> wrote in message
news:KVdLe.4956$Je.62@newsread2.news.atl.earthlink.net...
> "Paul" <paule-nospam@mindspring.com> wrote in message
> news:11fpq86i78c9n7e@news.supernews.com...
> > Is there a way to automate (from Visual Basic) Acrobat converting a PDF
to
> > JPG format?  If not, any recommendations for third party tools would be
> > appreciated!  (would like to avoid calling a command line from the
> > application if possible)

See the thread "Saving PDFs as JPEGS using Acrobat API" at
www.accesspdf.com/Acrobat for additional ideas.

Cheers.
--
Bill Segraves


0
Reply Bill 8/15/2005 1:02:20 AM

Acrobat 7 Professional provides the ability to execute javascript within a
pdf file. Here is a small VB6 function that creates a .tif file. (It needs
error checking, and the ability to change the output path and file name, but
it demonstrates the principle.


Function MakeTIF(filename As String)
    ' make tif from pdf
    Set AcroExchAPP = CreateObject("AcroExch.app")        'create acrobat
app object
    Set AcroExchPDDoc = CreateObject("AcroExch.PDDoc") ' acrobat doc objects
    Set jso = AcroExchPDDoc.GetJSObject
    jso.SaveAs filename & ".tif", "com.adobe.acrobat.tiff"
    AcroExchPDDoc.Close
    AcroExchAPP.Exit
End Function


You may want to download as much of the Acrobat SDK as you can for free. At
least download the documentation - it has a number of javascript and VB
examples, and it seems better than some of Adobe's obtuse documentation.


"Paul" <paule-nospam@mindspring.com> wrote in message
news:11fpq86i78c9n7e@news.supernews.com...
> Is there a way to automate (from Visual Basic) Acrobat converting a PDF to
> JPG format?  If not, any recommendations for third party tools would be
> appreciated!  (would like to avoid calling a command line from the
> application if possible)
>
> Thanks.
>
> -- Paul
>
>
>


0
Reply Dan 8/15/2005 1:40:01 AM

Paul wrote:
> Is there a way to automate (from Visual Basic) Acrobat converting a PDF to
> JPG format?  If not, any recommendations for third party tools would be
> appreciated!  (would like to avoid calling a command line from the
> application if possible)

If you can't get Acrobat or one of the other suggestions to work, you
could consider my company's (commercial) software: we have a standalone
DLL engine with a Visual Basic API that converts PDF to JPEG at any dpi
resolution.

See www.visual-integrity.com for more info and evaluation options if
interested. And/or contact me directly.

Jeroen Dekker
jeroen@square1.nl

0
Reply jeroen 8/15/2005 9:27:01 AM

On Fri, 12 Aug 2005 14:22:52 -0400, Paul wrote:

> Is there a way to automate (from Visual Basic) Acrobat converting a PDF to 
> JPG format?  If not, any recommendations for third party tools would be 
> appreciated!  (would like to avoid calling a command line from the 
> application if possible)
> 
> Thanks.
> 
> -- Paul

If you can deal with java, consider the PDFBox project
(http://sourceforge.net/projects/pdfbox). It is not ghostscript-based - it
actually renders the PDF using the java runtime. There is a .NET port but I
have not been able to get it to work with any rendering functions.
0
Reply Ross 8/16/2005 7:40:57 PM

11 Replies
741 Views

(page loaded in 0.092 seconds)

Similiar Articles:


















7/21/2012 5:34:41 PM


Reply: