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

kPDEPath that 'hide' text

$
0
0

Hello,

 

I have two kPDEPath, and some text elements 'overlapped' to these Paths.

One kPDEPath hide the corresponding text, the other Path does not hide the text. If I remove the first Path, I can see the hidden text element in the PDF.

 

My question is: why the two paths bheave in different ways? They have the same PaintOp (2) and GState values.

How can I determine if one path 'hide' some text or not?

 

Thank you


Get the file path for a file that already exists into Acrobat.com cloud

$
0
0

It seems that for the Adobe Acrobat application (less 11 version) the option of uploading files to Acrobat.com cloud it's by default activated.

Because of that, in the moment I am opening a file that was in advance uploaded in the cloud I get the next full path: "Acrobat.com: myFile.pdf" or "/Acrobat.com/959aa38a-5fce-40ba-9e3a-da241e90bfa4/0d85fd7d-b5cc-4c04-a732-8eada851ee80/My File.pdf"

The code I am using is:

PDDoc pdDoc = AVDocGetPDDoc(doc);

ASFile fileinfo = PDDocGetFile(pdDoc);

ASFileSys fileSys = ASFileGetFileSys(fileinfo);

ASPathName pathname = ASFileAcquirePathName(fileinfo);

 

char* szFilePath = ASFileSysDisplayStringFromPath(fileSys, pathname);

// szFilePath = "Acrobat.com: myFile.pdf"

char* szFilePath2 = ASFileSysDIPathFromPath(fileSys, pathname, pathname);

// szFilePath2 = "/Acrobat.com/959aa38a-5fce-40ba-9e3a-da241e90bfa4/0d85dd7d-b5cc-4c04-a732-8ecda851ee80/K ynesys-Visma.pdf"
// .... 

Is it a way to get the local temporary file full path out of these methods? ASFileAcquirePathName() works perfect for local files, out of Acrobat.com.
Otherwise is it a way to "download" the file into a local path?
I need to get the local location in order to proceed a Windows shell copy operation.  

is it possible to extract an annotation from a pdf document using sdk in c#

$
0
0

we need to extract annotations from multiple pdf files and we need to import to a different PDF file.

Thanks in advance.

Adding Header/Footer via Plugin

$
0
0

Hi All,

 

I am adding footer text to a PDF Document.

 

I have used the below code from adobe i can able trigger the header/footer dialogue i seen the values in textboxes as empty kindly do the needful.

I have used kAVCommandUIInteractive to keep dialogue visible.

WHere i went wrong?


InvokeAddHeadFootCmdSnip()

       ASAtom  cmdName;

                AVCommand   volatile  cmd =  NULL;

                AVCommandStatus  cmdStatus;

                volatile   ASCab  config =  NULL;

                volatile   ASCab  params =  NULL;

                volatile   ASCab  headFootCab =  NULL;

                volatile   ASCab  headFootCmdCab =  NULL;

                volatile   ASCab  headerCab =  NULL;

                volatile   ASCab  centerCab =  NULL;

                volatile   ASCab  footerCab =  NULL;

                ASBool  errorState =  false ;

                DURING

                                // Create an instance of the command.

                               cmdName =  ASAtomFromString(kAVCommandAddHeadFoot);

                               cmd =  AVCommandNew(cmdName);

                                if  (cmd==NULL){

                                                // if we cannot get the command, just alert. 

                                                AVAlertNote( "Cannot obtain the command" );

                                               errorState =  true ;

                                               

                               }

                                if  (errorState ==  false ){

                                                // We wish to invoke this command without any user interaction. See AVExpT.h for other UI policies

                                               config =  ASCabNew();

                                                ASCabPutInt(config, kAVCommandUIPolicy,  kAVCommandUIErrorsOnly);

                                                // Set command configuration 

                                               cmdStatus =  AVCommandSetConfig(cmd, config);

                                                // this command has no inputs.

                                               

                                                // we set up the parameters here, we will leave most as the default values.

                                               params =  ASCabNew();

                                               

                                                // this parameter contains two embedded ASCab objects

                                                // the first is data that is passed to the command, the other is data that drives the command.

                                               headFootCab =  ASCabNew();

                                                // we leave all parameters as the defaults except for the text...             

                                                // The actual text is maintained in two cabinets, one for the header and one for the footer.

                                               headerCab =  ASCabNew();

                                               centerCab =  ASCabNew();

                                               

                                               

                                                ASText  headText =  ASTextFromScriptText( "HeaderLeft" ,kASRomanScript);

                                                ASCabPutText(centerCab, "0" ,headText);

                                                ASCabPutText(centerCab, "1" ,headText);

                                                ASCabPutText(centerCab, "2" ,headText);

                                                ASCabPutCab(headerCab,kHeadFootCmdCenterCab,centerCab);

                                                ASCabPutCab(headFootCab,kHeadFootCmdHeadCab, headerCab);

                                               

                                               

                                                ASCabPutCab(params,kHeadFootCmdHeadFootCab,headFootCab);

                                               

                                               headFootCmdCab =  ASCabNew();

                                                ASCabPutBool(headFootCmdCab,kHeadFootCmdMakeOptional, true );

                                               

                                                ASCabPutCab(params,kHeadFootCmdHeadFootCmdCab,headFootCmdCab);

                                               

                                               cmdStatus =  AVCommandSetParams(cmd, params);

                               }

                                               

                HANDLER

                               cmdStatus =  kAVCommandInError;

                END_HANDLER

                if  (errorState ==  true ){

                                return ;

               }

               

                if  (params !=  NULL){

                                ASCabDestroy(params);

               }

                if  (config!=NULL){

                                ASCabDestroy(config);

               }

                               

                // we have set up the command, make sure there isn't a latent error

                // We're in silent mode, so we won't throw an alert dialog.

                if  (kAVCommandInError  == cmdStatus) {

                                AVCommandDestroy(cmd);

                                return ;

               }

                // we should be good to go at this point, execute the command.

               cmdStatus =  AVCommandExecute(cmd);

                // Release the resources associated with the command.

                AVCommandDestroy(cmd);

Multiple TextAppearance for single signature field

$
0
0

Good day,

 

I can successfully set the TextAppearance for a signature field.

I am trying to have multiple colours for one siganture field, e.g. name in black and location and date in grey.

 

Is it possible to have multiple text appearance for one signature field?

 

Regards,

Magda

Set default name of document before save

$
0
0

I have created a "save as" button on a form.

 

When the user presses the button (e.g., mouse up) I want the save as dialog box to appear with a NEW programmatically defined file name to appear.  (NOT the existing file name).

 

The block comes because saveAs is a restricted method.

 

Any clues how to accomplish this seemingly simple task?

is it possible to create a new project exactly similiar to the Stamper plugin project found in acrobat sdk samples

$
0
0

I want to create a plugin similiar to the stamper plugin found in Acrobat sdk sample. Or create one more menu item below "Stamper annotations" and when clicked it should paste the text i defined.

That is it should work exactly similiar to the stamper plugin. I created the menu items in the plugin, but not to do the stamping.  Kindly help. How to go about it.

Finding rotation of degrees of text

$
0
0

I have found vertical flow of text by using

PDWordGetAttrEx(thisWord, 0) & WXE_VERTICAL_FLOW,if(PDWordGetAttrEx(thisWord, 0) & WXE_ROTATED)

Please help me to find out the degree of rotation of text in pdf,i want to exact degrees.


How can retrieve pdf body?

$
0
0

How can retrieve pdf body? I need get pdf file then retrieve body (all document content in binary or any other format  ) encrypt this part (Better object by object or page by page )and then publish pdf without change pdf header or structure  then in destination open file decrypt body and show pdf. How can I do this? I prefer do all process in RAM.

Encrypt PDF file by elements

$
0
0

Hi all
I need decrypt a pdf file and I don’t want use embedded encryption api algorithm or sample program in api folders

I do this steps I want to know are this steps are correct or not

  1. 1-  Load file with this

AVDoc myAVDoc=AVDocOpenFromFile(pathName, fileSys, titleText);      

  1. 2-  export PDDoc by using this

 

       PDDoc myPDDoc2 =AVDocGetPDDoc(myAVDoc);

  1. 3-  acquire page by this

       PDPage p = PDDocAcquirePage(myPDDoc2,0);

  1. 4- acquire content

       PDEContent g= PDPageAcquirePDEContent(p,0);

  1. 5- get elementd

       g3=PDEContentGetElem(g,2);

  1. 6- after this with switch case I determine type of element

   ASInt32 tt = PDEObjectGetType(reinterpret_cast<PDEObject>(g3));

  1. 7- for example if the type is text by following casting , export PDEText

gali = reinterpret_cast<PDEText>(g3);

Now I need to know how can I encrypt PDEText , or how can I cast this type of data to binary data for encryption

Another question I want to know are this steps are correct? Or not, what is the correct solution and steps

 

I new in adobe api and PDF file structures and I need do this project as soon as possible. The project is this “get PDF file encrypt this file , not by default method. Encrypt elements or any pdf Components possible ”

  Regards

Split secured with restricted pdf

$
0
0

SecuredPdf.png

i have developed the code in C# to split the pdf files using adobe acrobat XI but recently i received the secured pdf files shown above is not splitting because of restriction. Please tell me is there any option to split this kind of files? is there any methods to disable the above properties in C#.

 

Anyway i want to split the above kind of files. Please share your information to get this done.

how to insert an image in a pdf document

$
0
0

I used the "Stamper" example and modified the fuction to insert image to my pdf doc.

PDAnnot CreateStampAnnotationAt(AVPageView pageView, AVDevRect *rect)

to add a picture Annotation into page.

when system calling the callback function "AnnotDraw" to draw the Cos Object in that Annotation ,the function "AVPageViewDrawCosObj(pageView, coApp, &avdr)" doesn't work.Here is the code:

ASFixedRect pdLocation;
PDAnnot annot = {0,0};
CosObj cAnnotObj, cIntObj, cStmObj, attributesDict, LengthEntry, cNullObj;
CosObj cAPDictObj, cStmDictObj, cBBoxObj, cProcSetObj, cResObj;
CosObj fontResObj, fontResObj2, cObj;
CosDoc cdoc;
ASStm stm;
char buf[512];
PDPage pdPage;
ASUns32 s;
ASFile picFile = NULL;
DURING
        //handle clicks (with no drag, or only in one direction), by creating a default size annot
        if((rect->top == rect->bottom) || (rect->right == rect->left))
        {
                rect->top +=75;
                rect->right += 150;
        }       
        pdPage = AVPageViewGetPage(pageView);
        AVDoc avDoc = AVPageViewGetAVDoc(pageView);
        AVPageViewDeviceRectToPage ( pageView, rect, &pdLocation);
        // Add the new annotation to the page.
        annot = PDPageAddNewAnnot(pdPage, -1, Stamper_K, &pdLocation);
        cAnnotObj = PDAnnotGetCosObj(annot);
        cdoc = PDDocGetCosDoc(PDPageGetDoc(pdPage));
        // See PDF Specification for more information on the Flags key.
        cIntObj = CosNewInteger (cdoc, false, 4L);
        CosDictPutKeyString(cAnnotObj, Flags_KStr, cIntObj);


        cAPDictObj = CosNewDict(cdoc, false, 1L);
        cNullObj = CosNewNull();

        ASFileSysOpenFile (ASGetDefaultFileSys (),ASPathFromPlatformPath("c:\\test.jpeg"), ASFILE_READ, &picFile);


        stm = ASFileStmRdOpen (picFile, 4096);
        attributesDict        = CosNewDict(cdoc, false, 5);

        LengthEntry = CosNewInteger(cdoc, false,11594 );


        CosDictPutKeyString(attributesDict, Length_KStr, LengthEntry);
        cStmObj = CosNewStream(cdoc, true, stm, 0, true, attributesDict, cNullObj, s);
        cStmDictObj = CosStreamDict(cStmObj);
        CosDictPutKeyString(cStmDictObj, "Type", CosNewNameFromString(cdoc, false, "XObject"));

        CosDictPutKeyString(cStmDictObj, "Subtype", CosNewNameFromString(cdoc, false, "Image"));

        CosDictPutKeyString(cStmDictObj, "Width", CosNewInteger(cdoc, false , 151));

        CosDictPutKeyString(cStmDictObj, "Height", CosNewInteger(cdoc, false , 151));

        CosDictPutKeyString(cStmDictObj, "ColorSpace", CosNewNameFromString(cdoc, false, "DeviceRGB"));

        CosDictPutKeyString(cStmDictObj, "BitsPerComponent", CosNewInteger(cdoc, false , 8));


        cBBoxObj = CosNewArray(cdoc, false, 4L);
        CosArrayInsert(cBBoxObj, 0L, CosNewInteger(cdoc, false, 0L));
        CosArrayInsert(cBBoxObj, 1L, CosNewInteger(cdoc, false, 0L));
        CosArrayInsert(cBBoxObj, 2L, CosNewInteger(cdoc, false, 100L));
        CosArrayInsert(cBBoxObj, 3L, CosNewInteger(cdoc, false, 100L));
        CosDictPutKeyString(cStmDictObj, "BBox", cBBoxObj);

        CosDictPut(cAPDictObj, FaceNormal_K, cStmObj);

        CosDictPutKeyString(cAnnotObj, Appearance_KStr, cAPDictObj);

HANDLER

        AVAlertNote(ASGetErrorString(ERRORCODE, buf, sizeof(buf)));

END_HANDLER

 

Please help.

manual encryption pdf file base pdf 32000-2008

$
0
0

hi all

At First special thanks to “lrosenth” and “Test Screen Name” for the good answers in the previous threads 

Now I have another question

In PDF32000_2008 explained pdf syntax considered as a four part

  1. 1) Objects
  2. 2) File structure - - -> use this for encryption
  3. 3) Document structure
  4. 4) Content stream

 

Also mention that:  “we have 8 object types “

1) Boolean

2) Numeric

3) String

4) Name

5) Array

6) Stream

7) Null

8) Indirect

This object have a structure like this:

 

5 0 obj

<< /Type /XObject

/Subtype /Image

/Width 52

/Height 66

/ColorSpace /DeviceGray

/BitsPerComponent 1

/Length 224

/Filter [/ASCIIHexDecode /JBIG2Decode]

/DecodeParms [null << /JBIG2Globals 6 0 R >>]

>>

stream

000000013000010000001300000034000000420000000000

00000040000000000002062000010000001e000000340000

004200000000000000000200100000000231db51ce51ffac>

endstream

endobj

6 0 obj

<< /Length 126

/Filter /ASCIIHexDecode

>>

stream

0000000000010000000032000003fffdff02fefefe000000

01000000012ae225aea9a5a538b4d9999c5c8e56ef0f872

7f2b53d4e37ef795cc5506dffac>

endstream

endobj

In encryption section mention that we can encrypt string, streams, … .

As I think and understand for encryption I must extract encrypt able objects, for this goal I do this steps

 

ASFileSys fileSys = ASGetDefaultFileSysForPath(pathType, myPath);

       ASPathName pathName = ASFileSysCreatePathName(fileSys, pathType, myPath, NULL);

      

       AVDoc myAVDoc=AVDocOpenFromFile(pathName, fileSys, titleText);      

       PDDoc myPDDoc2 =AVDocGetPDDoc(myAVDoc);

      

       CosDoc cdoc;

       cdoc = PDDocGetCosDoc(myPDDoc2);

       CosObj cosOBJ=CosDocGetRoot(cdoc);

       CosType t = CosObjGetType(cosOBJ);

// traverse pdf file structure tree

       CosObj obj2= CosDictGet(cosOBJ,ASAtomFromString("Pages"));

       CosType ttt = CosObjGetType(obj2);

      

       CosObj obj3= CosDictGet(obj2,ASAtomFromString("Kids"));

       CosType tttt = CosObjGetType(obj3);

      

       CosObj kid1 = CosArrayGet(obj3,0);

       CosType tttrtt = CosObjGetType(kid1);

 

       CosObj cosst = CosDictGet(kid1,ASAtomFromString("Contents"));

       CosType ttrrrttt = CosObjGetType(cosst);

 

       ASArraySize s = CosStreamLength(cosst);

      

       ASStm stm= CosStreamOpenStm(cosst,2);

      

       char buf[10000];

       int aaaaagyg=ASStmRead(buf,1,10000,stm);

             

       ASStmFlush(stm);

       ASStmClose(stm);

 

Now in buf I have content like this

/CS0 cs 1  scn

10 36 591.75 729.75 re

f

BT

0  scn

/TT0 1 Tf

12 0 0 12 16 749.25 Tm

(a b c)Tj

0 -1.125 TD

(d e)Tj

T*

(f)Tj

ET

 

I thinked with ASStmWrite  can write in this and change pdf content but this is not possible ,

Then this is my questions

Are this steps are correct or not ?

If yes how I can extract encrypt able object and after edit save them as pdf file.

else I think I must use Crypt Filter.

how I can get dictionary and change parameters for example set V value to 4

how I can retrieve pdf object (like example I mention before (5 0 obj ….) )

if need to make Crypt Filter how do this ?

for make Crypt Filter need to edit encryption dictionary,  how edit encryption dictionary?

I really thankful for your guidance and time you spend for answer my questions

Regard F.Afshari

how to avoid server busy dialog in iac

$
0
0

Hi,

 

I am a beginner in IAC. I am executing a plug-in throung an mfc based IAC dialog box.

But when my plug-in takes little longer time to execute a pdf, then I am getting a server busy dialog, asking swith to/retry option.

 

Can you please let me know how to get rid of this dialog.

 

I got the answer in c++ - How to disable dialog "switch to"-"retry"-"cancel" - Stack Overflow

to use

AfxOleGetMessageFilter()->EnableBusyDialog(0);
AfxOleGetMessageFilter()->EnableNotRespondingDialog(0);

But its giving error  error C2027: use of undefined type 'COleMessageFilter'

 

 

So please anyone help me to solve the issue.

 

 

Thanking You

Saffiuddin Sheikh.

How to use lock and unlock when dealing with multiple pdf documents

$
0
0

I need to deal with multiple pdf documents at a time,so how to use lock and unlock for this purpose.


How to get the Thumbnail Dragevent and pages being dragged

$
0
0

Hello,

 

Am developing a Plugin with Acrobat SDK.

I have created a Drop Window for the Thumbnails.

 

So i need to find out the Pages or Number of Pages that the user is dragging from the Thumbnail Pane so that i could create a new PDF which consists of these Pages been draged and drop on my Drop-Window.

 

Is there a notification for the Drag event from the Thumbnail Pane

and is it possible to get the pages being draged.

 

 

Thanks.

How to edit and save a pdf file using IAC

$
0
0

i need to insert an annoatation using ICA. The below code is using , but it is not working

 

ant = (AcroPDAnnot)pg.GetAnnot(i);

pgDest.AddAnnot(i, ant);

 

pls help.

Problems converting a Word document to PDF using Adobe PDF printer in .NET

$
0
0

I've been trying to get my .net web application to convert a word document to a PDF file using the Adobe PDF printer.

The script I'm trying to run is:

         Dim pProcInfo As New ProcessStartInfo

        pProcInfo.FileName = "C:\www\WordTemplate\Toconvert\File1.docx"

        pProcInfo.Verb = "Print"

        pProcInfo.CreateNoWindow = True

        pProcInfo.WindowStyle = ProcessWindowStyle.Hidden

       Dim pMyProc As Process = Process.Start(pProcInfo)

        pMyProc.WaitForExit()

 

I am running this on Windows Server 2008 R2 with Adobe PDF set as the default printer but running the above script just runs until it times out without producing the PDF. It's a small file only about 300KB. I've also tried running the executable AdobePDFPrintSilent.exe from the SDK in the script with the same result. Works fine if I run it on the server myself from the command line with the proper arguments but not from the .net application. I've given the IIS user account (IIS_IUSRS) Read & Execute, List folder contents, Read, and Write permissions to the folder as well and the NETWORK and NETWORK SERVICE accounts have the same. The Adobe PDF printer has permissions set to Everyone and I even included the IIS user account with the same permissions just to be sure. I have Word 2013 installed on the server as well. Is there just some permissions I'm missing somewhere?

Thanks for the help.

PDF traversal

$
0
0

as mention in pdf 32000

pdf structure is like below image

pdf stucture.jpg

what is the best solution for traversal this structure?

something like this or not

CosDoc cdoc;

cdoc = PDDocGetCosDoc(myPDDoc2);

 

CosObj cosOBJ=CosDocGetRoot(cdoc);

CosType t = CosObjGetType(cosOBJ);

 

  CosObj obj2= CosDictGet(cosOBJ,ASAtomFromString("Pages"));

  CosObj obj3= CosDictGet(obj2,ASAtomFromString("Kids"));

  CosObj kid1 = CosArrayGet(obj3,0);

  CosObj cosst = CosDictGet(kid1,ASAtomFromString("Contents"));

  CosObj resou = CosDictGet(kid1,ASAtomFromString("Resources"));

  PDEContent pddd=PDEContentCreateFromCosObj(&cosst,&resou);

 

 

  int jjj=PDEContentGetNumElems(pddd);

  for(int i=0;i<jjj;i++)

  {

  PDEElement ele=PDEContentGetElem(pddd,i);

}

 

this elemnt is base of pdf structure or not

is there any function for determine the cos object type (Pages , dictionarys, Kids ,....)?

 

i want to traversal  the pdf structure for create a same pdf file (dont want use copy or any thing like that i want traversal to details then make another copy of pdf ( and maybe do some little changes in contents not structure ))

 

is there any way you can show me ?

Error during opening a file

$
0
0

The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)) at Acrobat.AcroAVDocClass.OpenInWindowEx(String szFullPath, Int32 hWnd, Int32 openFlgs, Int32 UseOpenParams, Int32 pgNum, Int16 pageMode, Int16 ZoomType, Int32 Zoom, Int16 Top, Int16 Left)

 

if (avDoc.OpenInWindowEx("E:\\Bimal\\TestFiles\\simple.pdf", 0, 2, 0, 0, 0, 0, 0, 0, 0))

Viewing all 2571 articles
Browse latest View live


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