Quantcast
Channel: Adobe Community : All Content - Acrobat SDK
Viewing all 2571 articles
Browse latest View live

Comparing two pdf

$
0
0

Hi All,

 

I have compared two pdf files using below method

 

DigSigCompareWords(docA, docB, true);

 

The report will be generated as document A document B where i'm seeing

all the compare words and matched text.

But i need to get  the consolidated report like the one i'm getting from adobe acrobat XI professional compare document with text only.

 

Any help will be appreciated.


Using PDDocCreateWordFinderEx, how to read words with underscore

$
0
0

I am using the PDDocCreateWordFinderEx to read words. I have the character type table on PDWordFinderConfigRec set to just space as word break character. Still a word with underscore is broken into two separate words. Ex: U59_1 is read as two words U59_ and 1. Please let me know if there are any other options I need to set so word with an underscore will not be split into two words while reading. Thanks.

 

-SY

Silent Printing via code for Adobe Reader X and upper versions does not work

$
0
0

Hi,

 

I developed a windows service in c#.net with framework 2.0, last 4 years its printing pdf files fine, but now this printing logic failed to print PDF doc version 9.5, 10, and 11.

 

Please help to find out solution, why this windows service started failing in printing for higher version of adobe reader documents.

 

One more intresting thing - this logic is working fine with destop test c#.net application, but not working with windows service.

 

My code is below -

 

 

 

        

System.Diagnostics.Process process = new System.Diagnostics.Process();

 

 

System.Diagnostics. ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo(this.Adobe_File_And_Path);

    

process.StartInfo = psi;

process.Start();

   

psi.UseShellExecute =  false;

 

 

psi.RedirectStandardOutput =true;

 

psi.RedirectStandardInput = true;

 

psi.RedirectStandardError = true;

 

psi.CreateNoWindow =true;

 

 

psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;

psi.Arguments = "/n /h /p \"" + this.PDF_Name_And_Path + "\"";

 

for (int i = 1; i <= 20; i++)

 

//20 loops is about 10 seconds

  {

 

System.Threading.Thread.Sleep(500);

 

//500 = 1/2 second.

System.Windows.Forms.Application.DoEvents();

 

//Process any waiting events

 

if (process.HasExited)

 

break;

 

//The loop

 

 

}

 

 

if (!(process.HasExited)) 

{

 

 

if(!process.CloseMainWindow())

 

 

 

{

 
System.Threading.Thread.Sleep(2000);

 

 

//2 second sleep

process.Kill();

 
 

//Kill forcefully

 

  

}

}

 

 

Waiting for your helping hand.

 

Thanks in advance.

Rakesh

  

 

 

 

  

 

}

}

How do I convert an html page to a pdf using the APIs in Acrobat XI?

$
0
0

I am creating a c# program that needs to loop through a list of URLs, open each as an html page and save it as pdf.  I see it is possible to save an html page as a pdf using the plug-in in XI but I'm wondering how to do this from an application using the APIs.  Can someone point me in the right direction? 

 

Thanks!

 

Lora

Comparing two PDFs using Compare Documents utility in Acrobat Pro in command line

$
0
0

I have a need to compare two PDFs based on text, images, annotations, formatting, headers/footers, styles etcetera. The Adobe acrobat pro tool is working very good as per my requirements. I need to call it through Java program or command line. It could be something which takes the two PDFs as argument and compare options as Pro version have - text, images, annotations, formatting, headers/footers and background and generates the list of differences. It could return the differences either in a form of pdf document highlighting the differences or the map which is mapping something like page numbers to the details of differences that are appearing.

 

This would be very helpful. Please answer asap.

Thanks in advance.

Populate a PDF done with Adobe Livecycle Designer

$
0
0

I have a pdf from an institution and I have been asked to populate it directly with data saved in an excel file. I have found that the pdf was done with adobe livecycle designer and with that program I can see the name of the fields in the form.

The pdf can be found in:

 

https://sedeelectronica.bde.es/f/websede/content/SPA/Form_TRA_clientes .pdf

 

I have thought to use a VB macro in the excel file to populate the pdf. I have been searching on Internet but by now, I am only able to read the values of the fields, but I can't change them.

Here is the main code:


Set gApp = CreateObject("AcroExch.app")
Set avDoc = CreateObject("AcroExch.AVDoc")
If avDoc.Open(FileNm, "") Then
   Set pdDoc = avDoc.GetPDDoc()
   Set jso = pdDoc.GetJSObject()
  jso.Getfield("FrmSolicitudTransferenciaEuros[0].FormContent[0].ordena nte[0].datosOrdenanteExterno[0].ordenante[0]").Value  = "new value"

    pdDoc.Save 1, FileNm
    pdDoc.Close
End If

avDoc.Close (True)

 

When I open the pdf, the "new value" doesn't appear in the field and if I debug it, jso.Getfield("FrmSolicitudTransferenciaEuros[0].FormContent[0].ordenan te[0].datosOrdenanteExterno[0].ordenante[0]").Value has always the same value, it doesn't change.

I have tried with several fields with the same results.


Any ideas?

Thank you in advance.

Transforming PDEElements with unusual clipping path

$
0
0

Hi all,

 

I'am developing an acrobat plugin to transform elements in a PDF file. I used "ObjShiftSnip" (PluginSupport\Samples) as a basis. It works perfectly in almost all cases I encountered.

 

However in the following case, a PDF file with only one visible element (PDEPath), I get the following results:

 

before:

before.jpg

after

after.jpg

 

The circle itself has been transformed (some units in the x and y direction). It would seem that a clipping path is not transformed (correctly). However, the "ShiftObjects" function loops through all elements recursively (PDEContainer, PDEForm, PDEClip,PDEPath,...). Also in almost all other cases PDEClips are transformed correctly.

 

You will find both PDF file here (14 kb each):

http://we.tl/PxAeogEUDw

 

Could someone point me in the right direction? Detecting these kind of situations would also be a great help.

 

Any help/pointers would be appreciated!

Automate PDF comparison

$
0
0

Does anyone know how to automate two pdf files using adobe acrobat. I want to do this because we want to compare hundreds of file every day through some automated process.

 

I have posted this query in acrobat javascript forum, it seems there is no solution by using javascript. I have been asked to check with acrobat SDK forum members.

 

http://forums.adobe.com/thread/1402691

 

Please let me know is there any programmatic(API or SDK ) solution available to do this?

 

Any kind of help will be greatly.


Preview PDF files using IPreviewHandler

$
0
0

Hi,

 

Not sure if this is the right place to ask the following question about doing a PDF preview in my C++ app. If not please suggest me where I can ask the question.

 

I used the following samples code to learn how to write a C++ app that will preview PDF documents.

 

Using Preview Handlers in Windows Vista" (C++)

http://www.codeproject.com/Articles/19744/Using-Preview-Handlers-in-Wi ndows-Vista

Preview Handlers Revisited (C#)

http://www.brad-smith.info/blog/archives/183

 

The preview mechanism is based on the COM interface IPreviewHandler and is initialised either by a file or a stream (depending on whether they implement IInitializeWithStream or IInitializeWithFile).

IPreviewHandler interface has a method to show the preview : IPreviewHandler::DoPreview() method.

 

However it always show the first page of the previewed PDF document. I would like to be able to tell the preview to go to a specific page. Is it possible ?

Can I display a PDF preview using IPreviewHandler or any other interface and go directly to a specific page on the document?

 

 

Thank You for all your help

Get Application Path

$
0
0

Hello there,

 

I guess I'm going to ask a stupid and very basic question...but, I'm not able to get the application path in order to create a folder "MyPlugin" within the plug-ins folder of Acrobat where I can store a log file for example.

 

The only anwer I was able to find was to use AVAppGetSpecialFolder(), but in the API Reference I cannot find that function.

 

Thanks for your help.

Password security with API - VB

$
0
0

Hello,

 

I hope that someone can give me a short example how I can add a simple password security option to a document using the API with VB!

I have read the API documentation (IAC & JS) without can find any usefull informations about that.

I guess it works with the JS-API - but how?

 

Thanks a lot

How do i create a password protected PDF file?

$
0
0

Hello,

 

I am working with VB6.0 and I have a requirenment to create a password protected pdf file in vb6.0.

 

I have successfully created a PDF file but how do i make it password protected?

 

Thank,

Krunal

Parsing out article text from a document

$
0
0

I have a client who has scanned old publications into .pdf and had them OCR'd.  They are from early last century and usually multi-column and the text jumps over pages.  If these sections of text are marked up as Articles in Acrobat Pro, how do I parse out the text of each article?

is it possible to create password protected pdf file using visual basic6.0?

$
0
0

Hello,

 

is it possible to create password protected pdf file using visual basic6.0?

 

Thanks

how to load bookmark tree in initial view setting by pdfmark reference

$
0
0

how to load bookmark tree in initial view setting by pdfmark reference


Class not registered (Exception from HRESULT: 0x80040154 ) on an app compiled in x86

$
0
0

So I have a document manager application that uses an Adobe Reader plug-in to view PDF files. I've been using the same dll for a few years and all has worked well until some of my clients started using Reader 11.

It's likely an environmental issue since it's only happening to certain people(quite a few however) and neither I nor QA can reproduce it. The error is above.

 

If the clients revert to Reader 10, all is well again. Most of them are on Win 7 x64.

The application is compiled as x86 and the "Display PDF in browser" option is checked.

 

Any help?

 

Thank you

call plugin C function from Javascript form event

$
0
0

I have a C DLL that needs to get the string from the form text box, process it, and return true or false during a form validate event to indicate whether the string passes or fails for the form box. The pdf runs on unnetworked Windows PCs and has access to all privilaged JS functions.The easiest way to do this is to create a JS function that is implemented in C/C++ using a HFT plugin and the JS function written in C is called from the field's form validate event handler written in JS. But it seems to me there is no really good way to do this through the official API.

 

AFExecuteThisScript from the Forms HFT goes the wrong way from C to JS. ExecuteThisScript from AFormApp/acroform.api also goes the wrong way from C/OLE to JS. I've never tried GetJSObject from CAcroPDDoc/acrobat.exe, but I dont think it understand an IDispatch or IEventSource obj. Here are some quotes from the official docs that reenforce my understanding.

 

 

JSObject cannot add new properties, methods, or objects to JavaScript. Due to this limitation, the global.setPersistent property is not meaningful.

 

JSObject can process most elemental Visual Basic types for property puts and input parameters to method calls, including Variant, Array, Boolean, String, Date, Double, Long, Integer, and Byte. JSObject can accept Object parameters, but only when the Object was the result of a property get or method call to a JSObject. JSObject fails to accept values of type Error and Currency.

 

AcroFormRegisterObserver is deprecated in 8.0, and has no examples or docs of its usage. "FieldValidateChange" seems to be what I want to hook, but even if it does work, what is "void * info" in AF_NotificationProc? How do I find out in the notification callback what field in the form this was?

 

Another idea is having the validate JS event code do loopback over tcpip. This involves a non-acrobat process, or in-acrobat process, using a plugin, create a OS thread, which uses OS socket facilities to open a listening port, and basically wrapping the C DLL that has the field validation logic. Net.HTTP is async only, so the validate event handler will return control back to the internal idle loop in Acrobat, leaving the form in a non validated state for a second or 2 until the JS callback ("oHandler") runs.  The other choice I see for loopback is SOAP object in sync mode. I dont like the idea of doing loopback within the same process basically.

 

Another idea is app.execMenuItem, register a menu item in C with AVMenuItemSetExecuteProc.  Then the JS event code calls app.execMenuItem which in turn executes the C code function. My testing shows escript.api shows up in the callstack and if I put a C breakpoint in menu item callback C function, all of acrobat's GUI in all windows freezes. So I think app.execMenuItem is syncronous, and the closest thing to calling C code from the JS engine in acrobat. But app.execMenuItem has a problem. There is no way to pass any data to the menu item. The JS validate event code would need to serialize the validate event object, assign it to the doc obj, then do the execMenuItem, then the C func does a AFExecuteThisScript with "event.value = serializedvalidateevent;" as the script to fetch it into C land, deserialize char** pRetValue in C, then perform the validation logic in C (hand off to frunction from non-acrobat aware DLL), then do sprintf to create a new script, and a 2nd AFExecuteThisScript to return the result to JS land attaching it to the doc obj. Then the menu item C func returns. Then the validate event JS code reads the C to JS result member of the doc obj, and acts accordinglying. I wrote some code and tested this theiry and it works, but the idea is rediculously complicated for comunicating between JS and C.

 

Another idea is messageHandler.postMessage. I am not sure if this is syncronous or async (the validate event returns after the postMessage, a HostContainer.postMessage would be required to deliver the result, but the field is now showing a possibly invalid value for a second). But postMessage is from acropdf.dll, and AFAIK that means I will loose the acrobat menubar (toolbars appear in browser windows, the acrobat menubar doesnt) and the UI is standalone acrobat, not acrobat embedded in another app.

 

Looking at Acrobat 4, and AFGetScriptingContext and an example online of AFGetScriptingContext's usage. It appears Acrobat used to expose a complete SpiderMonkey engine for plugins. Looking at the export table of AcroJS32.dll shows all of SpiderMonkey's normal function calls. Adding your own JS methods written in C++ is as easy as following Mozilla's docs. But in Acrobat 7 and newer (I dont have access to 5 or 6), there is no AcroJS32.dll, instead there is Escript.api which just exports PlugInMain so this thing probably offers a HFT of its own to control the JS engine from other plugins. Acroform.api's AFGetScriptingContext is hardcoded to always return 0 in 7 and newer. So is there anyway for a plugin to register itself with Escript.api's HFT or that is undocumented and the execMenuItem insanity is the only way to write a JS function in C for Acrobat?

Why is PDDocAcquirePage too slow if giving a large pageNum

$
0
0

Hi,

 

Our product uses PDFL as a component. Our customers suffer a performance when they handle a pdf which has 115,000 pages.

I found it is PDDocAcquirePage() that causes the performance issue.

 

I wrote a sample demo by just opening a pdf file and calling PDDocAcquirePage and reproduced the issue.

 

The table below is what I got for PDFL7 and PDFL11. The 1st column values are the page numbers I passed to PDDocAcquirePage. The 2nd and 3rd columns are time consumption calculated by calling GetTickCount().

 

PageNumPDFL7PDFL11
000
10000797359
200002797641
1100002429710828

 

From the table, I notice there is big performance improvement to PDDocAcquirePage() in PDFL11 comparing to PDFL7.

 

But my question is - why the time consumption increases so much with the increasing of the page number on both PDFL7 and PDFL11? what could I do on my side to improve the performance when acquire pages with big page numbers?

 

(my test environment is Win7 x64)

 

Thanks in advance!

Unhandled exception at 0x779a385b in Acrobat.exe: 0xC0000374: A heap has been corrupted

$
0
0

Hi,

 

In our project, we are getting all book marks from PDF file for display purpose.

We are getting “Unhandled exception at 0x779a385b in Acrobat.exe: 0xC0000374: A heap has been corrupted” exception while getting Action from particular bookmark. But this is working fine for all other bookmarks, Please find the code we used below:

 

CString CPGRBookMarkMC::GetBookMarkDetails(PDBookmark bmObj)

{

       CString csBookmarkDetails;

       //Ensure that the bookmark is valid

       char * bmName = NULL;

       ASInt32 bufSize = PDBookmarkGetTitle(bmObj, NULL, 0) + 1;

       //Allocate the size of bufSize to the character pointer

       bmName = (char*)ASmalloc((os_size_t)bufSize);

       //Populate bmBuf with the bookmark's title

       PDBookmarkGetTitle(bmObj, bmName, bufSize);

       DURING

              if (!PDBookmarkIsValid(bmObj))

                     E_RETURN(csBookmarkDetails);

       PDAction objAction = PDBookmarkGetAction(bmObj);

       if(PDActionIsValid(objAction))

       {

              PDViewDestination objDest = PDActionGetDest(objAction);

              ASInt32 bmPageNum = 0;

              ASAtom fitType = ASAtomNull;

              ASFixedRectP destRect = NULL;

              ASFixed zoom = NULL;

              PDViewDestGetAttr (objDest, &bmPageNum, &fitType, destRect, &zoom);

              char *tempPagenum = NULL;

              tempPagenum = (char*)ASmalloc((os_size_t)bufSize);

              itoa(bmPageNum, tempPagenum, 10);

              strcat(bmName ,",");

              strcat(bmName, tempPagenum);

              csBookmarkDetails = bmName;

       }

       HANDLER

             

       END_HANDLER

 

       return csBookmarkDetails;

}

 

This unhandled exception is not handled in DURING/HANDLER block also. Please help us to resolve the issue.

PDEPath & DeviceN

$
0
0

If i get the gstate of a pdfpath that has a deviceN fill color, GState.fillColorSpec.value.color[x] is always 0, should't it contain the tint value?

 

PDEDeviceNColorsGetColorValue(GState.fillColorSpec.value.colorObj2,x) does give the correct tint

 

My issue is i have to change the tint for certain colorspaces, i have tried setting GState.fillColorSpec.value.color[x] with PDEElementSetGState but there is no affect.

 

How can you change the fill value for an element under a device n colorspace?

Viewing all 2571 articles
Browse latest View live


Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>