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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I use VB6(not .net) to convert PDF files to PostScript

Status
Not open for further replies.

kabir06

Programmer
Aug 18, 2006
4
US
I'm writing a VB program that needs to rename files, and then convert some of them to PostScript. Here's what I tried doing.

Set acrobatApp = CreateObject("AcroExch.App")
Set pdfDoc = CreateObject("AcroExch.PDDoc")
pdfDoc.Open "C:myfile.pdf"
strPDFFileName = "C:myfile.ps"
pdfDoc.Save &H1, strPDFFileName
pdfDoc.Close
acrobatApp.CloseAllDocs
acrobatApp.exit
Set pdfDoc = Nothing

This did not work, because even though it appeared to have saved it as a PostScript, it was still a PDF. That makes sense, I would think I need to do a SaveAs

And here's where I have the problem. Tried different combinations (DocSaveAs on the AcroApp as well as PDFDOC object).
Decided to try the MenuItemExecute. But although I see examples suggesting using the "Open" and "Saveas"
AcroApp.MenuItemExecute ("Open")
AcroApp.MenuItemExecute ("SaveAs")

there's no hint on the syntax for the filename to open and save as. where do I provide the file name to open..and filename to save as?
I tried ...
AcroApp.MenuItemExecute ("Open") filename
AcroApp.MenuItemExecute ("SaveAs") filenamesaeas..


I even tried
AcroApp.MenuItemExecute ("Open")
SendKeys ("testpdf{Enter}")

AcroApp.MenuItemExecute ("SaveAs")
SendKeys ("sample.ps{Enter}")

but no luck...please help.
 
Does anyone have any new ideas on this problem?

Trying to get Acrobat to convert a pdf file to postscript.. using Visual Basic 6.

 
tried ghostscript..and got this error

downloaded and installed ghostscript on home pc..and it worked fine...but gave errors for this file when I ran the same executable on my work pc.. ...any ideas


C:\>pdf2ps c:\temp.pdf c:\temp.ps

**** Warning: Fonts with Subtype = /TrueType should be embedded.
The following fonts were not embedded:
Arial-BoldMT
ArialMT
TimesNewRomanPSMT
Verdana

**** This file had errors that were repaired or ignored.
**** The file was produced by:
**** >>>> Acrobat Distiller 6.0 (Windows) <<<<
**** Please notify the author of the software that produced this
**** file that it does not conform to Adobe's published PDF
**** specification.


C:\>
 
The fonts not embedded warning means that you did not select font embedding when writing the pdf. It's best to use the Press setting when making any pdf but especially one that will be run to postscript. You can also use the X1A setting. Both those settings embed the propper subsets of all fonts used. You can check for proper embedding by going to File/Document Properties/Fonts.

Acrobat pro can run what you want to do without writing a script. Under the Advanced menu select Batch Processing. Make a new batch and name it and choose some innocuous action - like strip comments if your pdfs don't have comments. If you just want to save the batch pick Ask on the "run command on". Later, when that batch is opened you can select a folder of pdfs to run it on.

Then click on the Output options. There you will find postscript as one of the output file formats.

That batch can then be used on subsequent documents.

Using OSX 10.3.9 on a G4
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top