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

Error Digital Signature C# Acrobat Sdk

$
0
0

Hi.
I am creating an application to sign a pdf from c #.
I am currently having the following problem:

 

System.Runtime.InteropServices.COMException: 'Nombre desconocido. (Excepción de HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))'

 

This is the code:

 

            Type AcrobatCAcroAppType;

            AcrobatCAcroAppType = Type.GetTypeFromProgID("AcroExch.app");

            Acrobat.CAcroApp gapp = (Acrobat.CAcroApp)Activator.CreateInstance(AcrobatCAcroAppType);

 

            Type AcrobatPDDocType;

            AcrobatPDDocType = Type.GetTypeFromProgID("AcroExch.PDDoc");

            Acrobat.CAcroPDDoc gpddoc = (Acrobat.CAcroPDDoc)Activator.CreateInstance(AcrobatPDDocType);

 

            object jso;

 

            if (gpddoc.Open("C:\\Users\\tmuñoz\\Desktop\\PDFs Para firmar\\Thuban-Nivel 2.pdf"))

            {

                jso = gpddoc.GetJSObject();

                object[] param = new object[1];

 

                param[0] = "C:\\Users\\tmuñoz\\Desktop\\ThomasMuñoz.pfx";

 

                object con = jso.GetType().InvokeMember("SetUserDigitalIDPath",

                BindingFlags.InvokeMethod, null, jso, param);

 

                param[0] = "testpassword";

                con = jso.GetType().InvokeMember("SetUserPassword",

                BindingFlags.InvokeMethod, null, jso, param);

                param[0] = jso;

 

                con = jso.GetType().InvokeMember("AddSignature",

                BindingFlags.InvokeMethod, null, jso, param);

            }

 

 

I think the error comes from not finding these functions in the JSO object.
From what I understand these are the sdkAddSignature file.
So I guess I should integrate it into the C # project, but I do not know how to do it.


AvDoc FindText returning to first page.

$
0
0

Hi,

 

I am attempting to implement AVDoc.FindText in an excel VBA script to find and highlight all instances of a search term in a document.  Here is the code I have:

 

Dim AcroApp, AcroAVDoc

    Dim gPDFPath, bReset, nCount

    gPDFPath = "PATH TO FILE"

    ' ** Initialize Acrobat by creating App object

    Set AcroApp = CreateObject("AcroExch.App")

    ' ** show Acrobat

    Call AcroApp.Show

    ' ** Set AVDoc object

    Set AcroAVDoc = CreateObject("AcroExch.AVDoc")

    ' ** open the PDF

    If AcroAVDoc.Open(gPDFPath, "") Then

    Call AcroAVDoc.BringToFront

    bReset = True: nCount = 0

    Do While AcroAVDoc.FindText("Text to Find", True, True, bReset)

         bReset = False: nCount = nCount + 1

    Loop

...

End Sub

 

But the problem is that the Do While Loop does not seem to resolve itself.  Once the FindText function finds the last instance of text in the document, it then finds the next instance, on Page one.  This of course causes that while loop to never terminate.

 

Anyone know what my issue could be, am I interpreting incorrectly how BReset should be working?

 

Adobe 2017 Pro (2017.011.30110)

Excel 2010

How can detect PDF version by js or IAC?

$
0
0

PDF file has version 1.5,1.6,1.7

I had try get in Info object , but it not exist:

console.println( this.info.toSource());

How can detect PDF version by js or IAC?

Thank you.

Adobe Acrobat SDK - List of Preference Items

$
0
0

I am working on creating a vba script (Excel) that will create a pdf and fix the width of the document to size of the view port.  I reviewed the Interapplication Communication API Reference documentation that list all of the methods and properties of the api.  I want to use the “SetPreferenceEx” method to set the  Zoom preference  to  a value of Fit Width.  In the instructions (page28), the method provides the data type and description of the parameters. The first parameter is expecting an application preference to be provided, for example, I would expect to be able to pass “Zoom” into this parameter.  I have been unsuccessful in trying to set this parameter.  The description says to go to the Acrobat and PDF Library API reference for a list of preference items.  I found the document here , the issue I am having is that document has over 6,000 pages and I have been unsuccessful in finding the  list of preferences.  I was hoping you could provide me with a cheat sheet or a page number of where I can locate the list. 

Annotation Line Points Property WriteBack via IAC

$
0
0

I have posted this same issue on SO as well: javascript - Acrobat SDK IAC Modify Annotation Points Property - Stack Overflow

 

What I am trying to do at the moment was what I thought to be very trivial but is proving to be a confusing exercise. I simply wish to create a new annotation that is a line and set the points property to a specific value. When the object is initialized and set to "Line" type I can read the default points property, which it's value and datatype during debugging are as follows:

 

Points_DataType.png

 

So I tried a very simple assignment operation for testing by doing the following:

 

oLineAnnotation.points = New Object(1) {New Object(1) {100.0, 100.0}, New Object(1) {100.0, 100.0}}

 

This will throw the following exception: The server threw an exception. (Exception from HRESULT: 0x80010105 (RPC_E_SERVERFAULT)).

 

I have tried other methods of assignment as well, i.e writing back to specific index in the property array:

 

oLineAnnotation.points(0) = New Double(1) {100, 100}

 

This doesn't throw an exception, but nothing is written back to the property. I've tried varying methods of writing back to the property but nothing has worked so far (not working being an exception is either thrown OR no exception is thrown but the points property doesn't change at all to the specified value after assignment)

JS SDK visible digital signature

$
0
0

Is it possible to use SDK JavaScript API  to sign (visible digital sign) a file in the browser on the client side?

 

in sample for js

 

 

functionAddSignature(doc)

 

{

    // if ACROSDK.sigDigitalIDPath is not spcified, ask for user input

    if(ACROSDK.sigDigitalIDPath == "UNKNOWN"){

        varcResponse = app.response({

                cQuestion:"Input your digital ID path:",

                cTitle:"Digital Signature",

                cDefault:"/C/DrTest.pfx",

        });

      

        if ( cResponse == null) {

            app.alert("No input.");

            return;

        }

        else

            SetUserDigitalIDPath(cResponse);

    }

      

    // if ACROSDK.sigUserPwd is not spcified, ask for user input

    if(ACROSDK.sigUserPwd == "UNKNOWN"){

        varcResponse = app.response({

                cQuestion:"Input your password:",

                cTitle:"Digital Signature",

                cDefault:  "testpassword",

        });

      

        if ( cResponse == null) {

            app.alert("No input.");

            return

        }

        else

            SetUserPassword(cResponse);

    }


    // create a new signature field

    varsignatureField = AddSignatureField(doc);


    // sign it

    if(signatureFieldSign(signatureField, ACROSDK.sigHandlerName);

}

Problems accessing the app.newDoc () application

$
0
0

Good afternoon.
I am currently creating an application with Acrobat in .Net C #.
But I have problems accessing the app.newDoc () function.

 

 

c#:

            mApp = new AcroApp();       

            avDoc = new AcroAVDoc();   

          avDoc.Open("C:\\Users\\tmuñoz\\Desktop\\Thuban-Nivel 1.pdf", "");

            pdDoc = (CAcroPDDoc)avDoc.GetPDDoc();         

            object jso;        

            jso = pdDoc.GetJSObject();

            object[] param = new object[2];

object con = jso.GetType().InvokeMember("app.newDoc", BindingFlags.InvokeMethod, null, jso, param);

 

error:

System.Runtime.InteropServices.COMException: 'Nombre desconocido. (Excepción de HRESULT: 0x80020006 (DISP_E_UNKNOWNNAME))'

 

 

 

On the other hand, when making a similar code in VB.net, it works for me.

 

VB.net:

 

        gPDDoc = CreateObject("AcroExch.PDDoc")

        gPDDoc.Open("C:\Users\tmuñoz\Desktop\PDFs Para firmar\Thuban-Nivel 2.pdf")

        Dim doc As Object

        jso = gPDDoc.GetJSObject()

        doc = jso.app.newDoc()

 

 

From what I understand, I am calling the add.newDoc function wrong from c #, if so, I would like you to tell me how it should be the correct way to call it

ACROBAT SDK in Visual Studio

$
0
0

Hello guys. Im trying to build the samples from Acrobat SDK in Visual Studio 2015 but i get this error. Any help? erro2.PNG


Digital signatures development in Acrobat

$
0
0

I want to work with digital signatures over documents in Acrobat. I want to call some web services to get the certificates and sign the document. Is the plug-in the best approach? Or should i go with IAC or maybe with a java script approach? Thank you! And one more thing, if you have any tutorials or any other materials to begin with.

JPG pixel coordinates to PDF coordinates converter?

$
0
0

Hello,

 

Does anyone have a tool or know of the pixel conversions for a JPG image point to PDF document location?

 

Regards,

William Johnston

Create a DeviceN colorspace

$
0
0

Hi,

 

I need some help to create a DeviceN colorspace.

Thanks to the PDF Reference and this forum, I have written this function

 

// Creates a DeviceN colorspace

PDEColorSpacecreateDeviceN(PDDocpdDoc){

 

PDEColorSpacedeviceNColorSpace;

CosDoc    cosDocObj=PDDocGetCosDoc(pdDoc);

CosObj    colourSpaceCosObj=CosNewArray(cosDocObj,true,4);

 

// Names array

CosObj    namesCosObj=CosNewArray(cosDocObj,false,5);

CosArrayPut(namesCosObj,0,CosNewNameFromString(cosDocObj,false,"Cyan"));

CosArrayPut(namesCosObj,1,CosNewNameFromString(cosDocObj,false,"Magenta"));

CosArrayPut(namesCosObj,2,CosNewNameFromString(cosDocObj,false,"Yellow"));

CosArrayPut(namesCosObj,3,CosNewNameFromString(cosDocObj,false,"Black"));

CosArrayPut(namesCosObj,4,CosNewNameFromString(cosDocObj,false,"Blue"));

 

// Domain

CosObjcosDomainObj=CosNewArray(cosDocObj,false,10);

CosArrayPut(cosDomainObj,0,CosNewFloat(cosDocObj,false,(float)0.0));

CosArrayPut(cosDomainObj,1,CosNewFloat(cosDocObj,false,(float)1.0));

[…]

 

// Range

CosObjcosRangeObj=CosNewArray(cosDocObj,false,8);

CosArrayPut(cosRangeObj,0,CosNewFloat(cosDocObj,false,(float)0.0));

CosArrayPut(cosRangeObj,1,CosNewFloat(cosDocObj,false,(float)1.0));

[…]

 

// Function

//const char    *PostScriptFunc = "{ pop }";

constchar    *PostScriptFunc="{ 0.5 0.5 0.5 0.5 }";

ASInt32Size=strlen(PostScriptFunc);

 

CosObjcosFunctDict=CosNewDict(cosDocObj,false,4);

CosDictPut(cosFunctDict,ASAtomFromString("FunctionType"),CosNewInteger(cosDocObj,false,4));

CosDictPut(cosFunctDict,ASAtomFromString("Domain"),cosDomainObj);

CosDictPut(cosFunctDict,ASAtomFromString("Range"),cosRangeObj);

CosDictPut(cosFunctDict,ASAtomFromString("Length"),CosNewInteger(cosDocObj,true,Size));

 

ASStmStream=ASMemStmRdOpen(PostScriptFunc,Size);

CosObjPostScriptFuncStreamObj=CosNewStream(cosDocObj,true,Stream,0,true,cosFunctDict,CosNewNull(),-1);

ASStmClose(Stream);

 

CosArrayPut(colourSpaceCosObj,0,CosNewNameFromString(cosDocObj,false,"DeviceN"));

CosArrayPut(colourSpaceCosObj,1,namesCosObjP);

CosArrayPut(colourSpaceCosObj,2,CosNewNameFromString(cosDocObj,false,"DeviceCMYK"));

CosArrayPut(colourSpaceCosObj,3,PostScriptFuncStreamObj);

 

deviceNColorSpace=PDEColorSpaceCreateFromCosObj(&colourSpaceCosObj);

 

returndeviceNColorSpace;

}

 

According to an answer on a post of yokuju, I have tried to add the optional attributes by adding this part to the function

 

// Domain

CosObjcosDomainObj2=CosNewArray(cosDocObj,false,2);

CosArrayPut(cosDomainObj2,0,CosNewFloat(cosDocObj,false,(float)0.0));

CosArrayPut(cosDomainObj2,1,CosNewFloat(cosDocObj,false,(float)1.0));

 

// Range

CosObjcosRangeObj2=CosNewArray(cosDocObj,false,8);

CosArrayPut(cosRangeObj2,0,CosNewFloat(cosDocObj,false,(float)0.0));

CosArrayPut(cosRangeObj2,1,CosNewFloat(cosDocObj,false,(float)1.0));

[...]

 

// Function

constchar    *PostScriptFunc2="{ 1.0 1.0 0.0 0.0 }";

ASInt32Size2=strlen(PostScriptFunc2);

 

CosObjcosFunctDict2=CosNewDict(cosDocObj,false,4);

CosDictPut(cosFunctDict2,ASAtomFromString("FunctionType"),CosNewInteger(cosDocObj,false,4));

CosDictPut(cosFunctDict2,ASAtomFromString("Domain"),cosDomainObj2);

CosDictPut(cosFunctDict2,ASAtomFromString("Range"),cosRangeObj2);

CosDictPut(cosFunctDict2,ASAtomFromString("Length"),CosNewInteger(cosDocObj,true,Size2));

 

ASStmStream2=ASMemStmRdOpen(PostScriptFunc2,Size2);

CosObjPostScriptFuncStreamObj2=CosNewStream(cosDocObj,true,Stream2,0,true,cosFunctDict2,CosNewNull(),-1);

ASStmClose(Stream2);

 

CosObjcosBlueObj=CosNewArray(cosDocObj,false,4);

CosArrayPut(cosBlueObj,0,CosNewNameFromString(cosDocObj,false,"Separation"));

CosArrayPut(cosBlueObj,1,CosNewNameFromString(cosDocObj,false,"Blue"));

CosArrayPut(cosBlueObj,2,CosNewNameFromString(cosDocObj,false,"DeviceCMYK"));

CosArrayPut(cosBlueObj,3,PostScriptFuncStreamObj2);

 

// Colorants sictionary

CosObjcosColorantsDict=CosNewDict(cosDocObj,false,1);

CosDictPut(cosFunctDict2,ASAtomFromString("Blue"),cosBlueObj);

 

CosArrayPut(colourSpaceCosObjP,4,PostScriptFuncStreamObj2);

 

Even with the additionnal attribute, I still have the same issue as Sam BSW. If I use just one time this colorspace, the current page will be empty. In the PDF file instead of having something like

 

<</Contents 3 0 R/CropBox[0.0 0.0 612.0 842.4]/MediaBox[0.0 0.0 612.0 842.4]/Parent 162 0 R/Resources<</ColorSpace<</CS0 227 0 R/CS1 227 0 R>>/Font<</T1_0 12 0 R/ [...] /T1_9 29 0 R>>/ProcSet[/PDF/Text/ImageC]/XObject<</Im0 230 0 R>>>>/Rotate 0/Type/Page>>

 

for the page, I have simply

 

<</CropBox[0.0 0.0 612.0 842.4]/MediaBox[0.0 0.0 612.0 842.4]/Parent 162 0 R/Resources<<>>/Rotate 0/Type/Page>>

 

I am not a power user of the Adobe SDK so I am stuck here. I hope that someone can help me with my issue.

 

Thank you

Extracting thumbnails using Jpedal and thumbnaitor gives performance issue

$
0
0

Hi All,

 

We are trying to extract first page thumbnail from a pdf file . we are converting internally into image for first page and generating thumbnails . this process is taking too much time and giving performance issue .this is being done using java language .

 

is there any other API or toll we can use which will give better performance using java please suggest .

 

Our requirement - lots of pdf files are there with different size and size can be lead to max 30 MB file .

 

either the 1st page of pdf can be converted into image generate different size thumbnails or directly from pdf file to different thumb nail size .

 

either way is fine . please suggest .

 

Regards

Birupakshya

How to convert a jpg to PDF

$
0
0

I am currently trying to convert a jpg image into a pdf with the following code:

 

function JpgToPdf (doc, img)

{

     var myDoc = app.newDoc();

     // myDoc.Open("/C/Users/tmuñoz/Desktop/Thuban-Nivel 2.pdf");

     myDoc.disclosed = true;

     doc.disclosed = true;

     newDoc = app.openDoc({

          oDoc: doc,

          cPath: img,

          bUseConv: true

     })

     newDoc.disclosed = true;

     var filePath = "/C/Users/tmuñoz/Desktop/Adobe/temp.pdf";

 

     //MySaveAs(newDoc,"/C/Users/tmuñoz/Desktop/Adobe","Thomas23.pdf");

     newDoc.saveAs({

             cPath:"/C/Users/tmuñoz/Desktop/Adobe/temp.pdf"

         })

newDoc.closeDoc(true);

}

 

The following code is not working and it sends me the following error:

 

RaiseError: The file may be read-only, or another user may have it open. Please save the document with a different name or in a different folder.

Documentation on the object model for AdobePDFMakerForOffice COM add-in

$
0
0

I am trying to create PDF files from Office using the AdobePDFMakerForOffice, but can't seem to find any documentation on the SDK about this COM add-in.

attachments

$
0
0

You can find attachments using PDDocGetNameTree in Acrobat SDK.

However, I want to find the number of MAX pages and the named destination of the attached file.


Anyone know why Acrobat's update (2019.010.20019) broke my JS coding. Most of the code dates back to 9/X but now some of the global vars are saved but then not gotten from GlobData.

$
0
0

Anyone know why Acrobat's update (2019.010.20019) broke my JS? Most of the code dates back to 9/X and have been updated for privilege and security changes (10.1.1) but now the global vars all are saved but then a couple of vars aren't retrieved from GlobData and those vars default to default settings. Anyone run into a similar experience? The only change was updating to 20019 from 20069.

How to make a PDF document accessible by custom based rule?Make Accessible in Adobe doesn't cover all the aspects which leads us to either manually create the tag or edit lot of existing tags.

$
0
0

Hi,

We are facing an issue with the Make accessible feature in the Adobe. It's not covering all aspects which lead to manual intervention.

We are facing issues of adding new tags manually or make the entire document accessible manually. We wanted to create a plugin which will fix or create accessible tags based upon the custom rule defined.

 

Kindly let us know the best approach to solve this problem.

GUI on MAC

$
0
0

Hi,

I'm trying to find a sample of a plug in that would show a dialog on MAC. I see a sample with wxWidget but that is an overkill for me - I need very simple dialog and simple functionality behind it. I guess that that's an easy one, just don't know how to start.

Paolo

Plugin Unload

$
0
0

Hello,

Recently I've got a lot of complaints about Adobe acrobat plugin unload error in event logs on application closure which not happened before.

 

Error:

2/1/2019 10:05:12 AM Information Windows Error Reporting  1001 Fault bucket , type 0

Event Name: APPCRASH

Response: Not available

Cab Id: 0

 

 

Problem signature:

P1: Acrobat.exe

P2: 19.10.20069.49826

P3: 5c1a8755

P4: MyPluginAcrobat.api_unloaded

P5: 3.4.0.1

P6: 5bb35795

P7: c00001a5

P8: 00711dc0

P9:

P10:

 

 

Attached files:

\\?\C:\Users\userName\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook\7SLVAM2F\D ocument.pdf

\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER974E.tmp.dmp

\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER9AC9.tmp.WERInternalMetadata.xml

\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER9E55.tmp.xml

\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER9E62.tmp.csv

\\?\C:\ProgramData\Microsoft\Windows\WER\Temp\WER9F3E.tmp.txt

\\?\C:\Users\dlavange\AppData\Local\Temp\WERA57B.tmp.appcompat.txt

\\?\C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_Acrobat.exe_9bdafcba6cc317fa d52ace0f0e377c4459d00_d720f663_cab_3893a71d\memory.hdmp

 

 

These files may be available here:

\\?\C:\ProgramData\Microsoft\Windows\WER\ReportQueue\AppCrash_Acrobat.exe_9bdafcba6cc317fa d52ace0f0e377c4459d00_d720f663_cab_3893a71d

 

 

Analysis symbol:

Rechecking for solution: 0

Report Id: 2a6cc198-fcd4-48dd-8bca-16176a6a45d3

Report Status: 524388

Hashed bucket:

Cab Guid: 0

 

Most of the time this happens when user tries to open pdf document from outlook attachments does some actions through plugin and then close document.

In plugin unload function i calls AVAppUnregisterNotification for every callback i created and then destroy it via ASCallbackDestroy.

how to change the image in a digital signature

$
0
0

Good morning.

I am creating a program that automatically signs a PDF, but at the moment of signing I sign with a default image:

 

I would like to know some way to upload the image that I want.

Viewing all 2571 articles
Browse latest View live


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