THANKS!
There is no supported interface to doing this.
There are many things in Acrobat that have no automation interface.
Aandi Inston
HTH, Reinhard
~T
Using OLE Method 'SaveAs' ,It is converting to jpg.
But I Think Internal Jpeg format is not valid..
Because when i loading that file from Tpicture Component
in Delphi Its not Opening.
So we have to find another way
Himaja,INDIA
I do not see a method SaveAs in the IAC Reference. Please post more
details.
Aandi Inston
More info available at the URL below. You're welcome to contact me directly if interested.
Jeroen Dekker
--
Square One - The Graphics Connection
Visit <http://www.square1.nl/index.htm>
jer...@square1.nl
Aandi Inston
Sorry I Type 'saveas' instead 'Save'
In Acrobat.Lib there is
save method in interface of CAcroPDDoc
Iam using Delphi
we can convert pdf to jpeg using
method menuitemexecute('extractimages:jpeg') which is in AcroExch.App object.
then a savedialogbox will be opened.
by mentioning the name the images in pdf will be saved to jpeg.
but now my problem is how to give filename with out invoking of save dialogbox
Thanks in advance,
Himaja,INDIA
I do not understand how you could specify JPEG format for
PDDoc.SaveAs. What does your SaveAs call look like?
Aandi Inston
i given
PDDoc.save(PDSaveFull,'c:\Temp.jpg');
then it is saved.
but jpeg format is not valid in this case.
thats the problem.
so i try using menuitemexecute. its ok.
but my problem is savedialogbox is invoking.
pls tell me
if u know
how to use api files in other programming languages.
So, you are saving a PDF file.
You choose to call it temp.jpg, but it is still a PDF file.
Just as, if you put a label on a banana saying "orange", it is still a
banana.
This method is for saving PDF files. It does not give access to the
"save as format" options of Acrobat.
> how to use api files in other programming languages.
You mean plug-ins? These must be written in Visual C++.
Aandi Inston
Aandi Inston
Aandi Inston
Himaja
//Saves file as a jpg
app.addMenuItem({ cName: "Save As>JPEG", cParent: "File",
cExec: "this.saveAs('/c/JPGFolder/NewJPEG.jpg', 'com.adobe.acrobat.jpeg');",
cEnable: "event.rc = (event.target != null);",
nPos: 0
});
Then you need to execute it from VB or as the examples below shows VBScript:
'create the script object
Set WshShell = WScript.CreateObject("WScript.Shell")
'use the wshell to launch Acrobat
WshShell.Run ("Acrobat.exe")
WScript.Sleep 7000
'Open a file
' This is a necessary evil... due to the then next item in the script.
WshShell.run "Acrobat.exe C:\Program Files\Adobe\Acrobat 6.0\Help\ENU\ACROHELP.PDF"
WScript.Sleep 1000
'If Acrobat or no document is open you get an error message about file not found... doh!
set WshShell = CreateObject ("Wscript.Shell")
WshShell.AppActivate("Adobe Acrobat")
WScript.Sleep 500
'open a file
'Get the active Document for use with JSObject
Set AcroApp = CreateObject("AcroExch.App")
Set AVDoc = AcroApp.GetActiveDoc
Set PDDoc = AVDoc.GetPDDoc
set jso = PDDOC.GetJSObject
'Do something with jso
jso.app.execMenuItem("Save As>JPEG")
However the issue is with 'control'. There is no controlling resolution or compression using this process.
~T
"this.saveAs('/c/JPGFolder/NewJPEG.jpg', 'com.adobe.acrobat.jpeg');"
This works not in versions before v6x. In v5x you may consider to use simple "SendKeys", perhaps with special window control/check (WinAPI, AutoitX.dll).
Best regards, Reinhard Franke
"this.saveAs ('/c/JPGFolder/NewJPEG.jpg', 'com.adobe.acrobat.jpeg');"
is not working in Acrobat5.
please explain in detail how to use "sendkeys"
as iam new to acrobat sdk programming
Thank U
Himaja
SendKeys is a method with VB of sending key presses to dialogs.
Suppose you do something and expect a dialog to appear. You might wait
a few seconds then send a ENTER, which is the same as clicking OK. It
is a very messy and unreliable way to program, and I couldn't
recommend it. If you want to know more about it, I suggest VB forums,
as it has no Acrobat connection.
Aandi Inston
Anyway, attached a simple working sample in VBS. Copy it via clipboard to an editor. Save it as AcSvAsJPG.vbs to your Desktop or Sendto directory and start with any PDF via Drag&Drop or right mouse click.
Be aware that this is a quick example, where I considered that you may not have an english version, which I also don't have (regional version independent :-)).
HTH, Reinhard
AcSvAsJPG.vbs :
----------------
REM: Save a Pdf as JPEG.
REM:Also Multipage PDF will can be changed. Then every page will be saved as single JPEG
REM: The Filename you can change to your needs.
REM: If you use Drag&drop or Filename as command
REM: line argument the script will work with this file.
'*********Settings in File**************************
FileNM = "C:\x.pdf" '//Filename for File to transfer if NO argument is given
'****************************************************
set WshShell = CreateObject ("Wscript.Shell")
set fs = CreateObject("Scripting.FileSystemObject")
Set objArgs = WScript.Arguments
if objArgs.Count = 1 then FileNM = ObjArgs(0)
Info = "Save as JPEG"&VbCr&_
"File Name: "&FileNM &vbCr&" Delete existing JPEG FILES with the same Name before!"&vbcr&" Start now?"
OK = MsgBox(Info, vbQuestion+vbYesNo,"Insert Files") : if OK = vbNo then WScript.quit
'//Start or switch to Acrobat
WshShell.run "Acrobat.exe"
While not WshShell.AppActivate("Adobe Acrobat") : Wscript.Sleep 1000 : Wend
Set gApp = CreateObject("AcroExch.App")
if not fs.FileExists(FILENM) then
MsgBox "Ups! " & FileNM & " doesn't exist? " & "Try new!", vbExclamation
WScript.quit
end if
Set BASFL = CreateObject("AcroExch.pdDoc")
OK = BASFL.Open(FileNM) '//Open the PDF-File
if not OK Then if MsgBox("Error open Basic File") then Wscript.quit
BASFL.OpenAVDoc(mid(FileNM,InstrRev(FileNM,"\")+1)) '// get the PDF-File into view
WScript.Sleep 1000
'// to get this part working reliable(!) use WinAPI, WMI, or AutoITX.dll to check the forground window
WshShell.SendKeys "^+s" '// send keys for SaveAs
WScript.Sleep 1000
WshShell.SendKeys "{tab}" '// goto Filetype
WScript.Sleep 500
WshShell.SendKeys "J" '// switch filetype zu JPEG
WScript.Sleep 500
WshShell.SendKeys "{tab}{Enter}" '// switsch to "Save" and save
WScript.Sleep 1000
Set BASFL = nothing : set gApp = nothing
i think , writing plugin is permanent solution for that.
i read the example in (acrobat sdk ->invoke command ).
But i dint understand how to add that plugin to acrobat.
Please Help me in that.
Thank U.
Himaja,INDIA.
A plug-in is compiled with Visual C++. Use the original project files.
The result is a *.API file, that you put in the Acrobat PLUG_INS
folder.
You should investigate the "FromPDF" methods.
Aandi Inston
Thank u very much Andi Inston
Iam able to add plug in acrobat.
i used the following command for conversion of pdf to jpeg
ASAtomFromString (kAVCommandExtractAsJpeg).
Here the problem is , it is
converting each image of that page to jpeg.
what command i have to use to convert pdf
to jpeg by page by page
Thanks in Advance
HimajaG
The parameters and keys to the FromPDF converters are not documented,
and may change between Acrobat releases. But at least it can be done.
Aandi Inston
In example
\Acrobat 5.0SDK\PluginSupport\Samples\AVCommands\InvokeCommand\sources
they given how to convert pdf to tiff.
but in that also , each object in that page is converting to tiff
They passed the command kAVCommandExtractAsTIFF
For JPEG i passed the command kAVCommandExtractAsJpeg.
so here also , each object in that page is converting to JPEG.
Thats it.
do u mean FROMPDF convertors ,
[AVConversion methods - AVConversionConvertFromPDFWithHandler]
Thank u
HimajaG
Yes, the AVConversion methods are what you want.
Aandi Inston
I dint understand how can i convert pdf to jpeg using
avconversion methods.
In example they given to convert from pdf to
uncompress pdf file.
but iam not getting any idea fro the conversion of pdf to jpeg
plz help me in that
thank u
Himaja
Enumerate the FromPDF handler to find the correct name of the PDF to
JPEG converter.
Set up this converter and get the default parameters.
Examine these parameters using guesswork to decide what parameters are
needed for your task. This is release dependent! Especially, options
like resolution exist in 5.0 but not 6.0.
You now have enough information to create and run a conversion.
Aandi Inston
/* fromPDFEnumProc
* * ----------------------------------------------------------------------
* *
* * Called by Acrobat as it cycles through each FromPDF handler.
* *
* / static ACCB1 ASBool ACCB2 fromPDFEnumProc(AVConversionFromPDFHandler handler,
AVConversionEnumProcData data)
{
DURING
//Get the name of this filter
ASInt32 len = 255;
AVFileFilterRec filterRec = handler->convFilter;
char * filterName = ASTextGetPDTextCopy(filterRec.filterDescription, &len);
//If it's the JPEG handler, then set our global handler to it.
//Name changed to just "JPEG" in 6.0
if (!strcmp(filterName, "JPEG Files"))
{
gConversionHandler = handler;
}
HANDLER
return false;
END_HANDLER
return true;
}
/* GetJPEGHandler
* * ----------------------------------------------------------------------
* *
* * Enumerate all conversion handlers so we can find the JPEG one.
* *
* /
void GetJPEGHandler()
{
AVConversionFromPDFEnumProc fromPDFEnumProcCB =
ASCallbackCreateProto(AVConversionFromPDFEnumProc, &fromPDFEnumProc);
AVConversionEnumFromPDFConverters (fromPDFEnumProcCB, NULL);
ASCallbackDestroy(fromPDFEnumProcCB);
}
/* INSERT THE REST OF THIS IN THE APPROPRIATE PLACE IN YOUR PLUG-IN */
GetJPEGHandler();
// Create the setting cabinet and provide the settings.
volatile ASCab settings = NULL;
settings = ASCabNew();
ASCabPutInt (settings, kExtractImgCmdKeyConvFormat, kImgConversionFormatJpeg);
ASCabPutInt (settings, kExtractJpegCmdKeyCompression, kJpegCompressionLow);
ASCabPutInt (settings, kExtractJpegCmdKeyFormat, kJpegFormatOptimized);
ASCabPutInt (settings, kExtractImgCmdKeyColorSpace, kColorSpaceGrayscale);
ASCabPutInt (settings, kExtractImgCmdKeyResolution, kImgResolution96);
// Call the converter.
AVConversionStatus thisStatus = AVConversionConvertFromPDFWithHandler (gConversionHandler,
settings, flags, thisPDDoc, thisASPathName, thisASFileSys, NULL);
// Clean up.
ASCabDestroy(settings);