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

Creating bookmarks from access(VBA)

$
0
0

Hi all,

 

Im creating a number of bookmarks from access 2010 via VBA. And it works fine except that the acrobat.exe file still remains in process permanently. Ive found that it is this line bookmarkList = bookmarkRoot.children which causes the acrobat.exe to stay in memory. I hope im missing something fundamental here.If i remove that line, acrobat.exe closes correctly and disappears from the proccess. Ive tried bookmarklist = null(long shot) and Set bookmarkList = Nothing without success. Im hoping someone can guide me in the right direction here Im using acrobat pro X. Can anyone replicate this issue or better yet know how to fix it?

 

dim bookmarkList as variant

dim objAdobe As Object

dim avDoc As Object

dim PDDoc As Object

dim PDPage As Object

dim JSO As Object

dimBookMarkRoot As Object

 

 

 

 

Set objAdobe = CreateObject("AcroExch.App")

Set PDDoc = CreateObject("AcroExch.pdDoc")

Set avDoc = CreateObject("AcroExch.avDoc")

 

pdDoc.open("C:\xxxxx \test.pdf") 'it has one page in it

 

Set JSO = PDDoc.GetJSObject

Set BookMarkRoot = JSO.BookMarkRoot

BookMarkRoot.createChild "TEST", "", 0

bookmarkList = bookmarkRoot.children'causes acrobat.exe to stay open in task manager(processes), have tried set bookmarkList= Nothing and bookmarkList= null

 

pdDoc.save(1,'C:\xxxx\test2.pdf')

 

Set JSO = Nothing

Set PDPage = Nothing

Set avDoc = Nothing

Set BookMarkRoot = Nothing

PDDoc.Close

objAdobe.CloseAllDocs

objAdobe.Exit

Set PDDoc = Nothing

Set objAdobe = Nothing

 

Regards,

 

Ingman


Problems with InsertPages and Bookmarks

$
0
0

Hi,

 

I am using the method InsertPages in Acrobat X Pro via VB6 to insert pages from one dokument into another, but I have some problems with it.

 

If I set the last parameter (Bookmarks) to False, then everything works perfectly, and the method inserts the pages I have specified. If, however, I set the Bookmarks parameter to True, it inserts all pages from the source document, no matter what range of pages I specify. If I try to insert 5 different pages with bookmarks from a document, I get the entire document inserted 5 times.

 

Example:

 

MyNewDocument.InsertPages MyNewDocument.GetNumPages - 1, SourceDocument, 0, 1, False

(Works like a charm)

 

MyNewDocument.InsertPages MyNewDocument.GetNumPages - 1, SourceDocument, 0, 1, True

(Inserts all pages from SourceDocument)

 

Am I missing something, or is there a bug somwhere?

Microsoft Access (VBA) & Acrobat 9 SDK - Some Answers, Some Questions

$
0
0

Previously our firm was using Acrobat 5.0 and we were using it to print a number of Reports from Access to PDF Files.  We were doing this by writing the filename to a registry location "HKEY_CURRENT_USER\Software\Adobe\Acrobat PDFWriter\PDFFileName".  With recent testing on Windows 7, we've opted to update to Acrobat 9 standard.  The following are some findings that WORK, examples:

 

 

1.  I am now able to Concatenate our PDF's thru the VBA code:

 

    Dim origPdfDoc As Acrobat.CAcroPDDoc
    Dim newPdfDoc As Acrobat.CAcroPDDoc
    Dim path As String
    Dim path2 As String
    Dim path3 As String
    Dim varNewTotalPages As Long
   
    path = "C:\Eng2007\JobBook_BackCover.pdf"
    path2 = "C:\Eng2007\JobBook_BackCover2.pdf"
    path3 = "C:\Eng2007\JobBook_NEW.pdf"
    Set origPdfDoc = CreateObject("AcroExch.PDDoc")
    Set newPdfDoc = CreateObject("AcroExch.PDDoc")
   
    If origPdfDoc.Open(path) Then
        If newPdfDoc.Open(path2) Then
            'Get total # of pages too insert
            varNewTotalPages = newPdfDoc.GetNumPages
            'Insert pages into original pdf
            origPdfDoc.InsertPages True, newPdfDoc, 0, varNewTotalPages, False
            'Save doc
            'origPdfDoc.Save PDSaveIncremental, path 'path doesn't matter, will save to original doc
            origPdfDoc.Save PDSaveCopy, path3
        Else
            MsgBox "Failed to open doc " & path2
        End If
       
        'Close docs
        origPdfDoc.Close
        newPdfDoc.Close
        MsgBox "Pages added to " & path3
    Else
        MsgBox "Failed to add pages to " & path3
    End If
   
    Set origPdfDoc = Nothing
    Set newPdfDoc = Nothing

 

 

2.  I am also able to add Bookmarks, and adjust SOME formatting:

 

    Dim gApp As Acrobat.CAcroApp
    Dim gPDDoc As Acrobat.CAcroPDDoc
    Dim jso As Object
   
    Set gApp = CreateObject("AcroExch.App")
   
    Set gPDDoc = CreateObject("AcroExch.PDDoc")
    If gPDDoc.Open("C:\Eng2007\JobBook_NEW.pdf") Then
        Set jso = gPDDoc.GetJSObject
       
        Dim BMR As Object
        Set BMR = jso.bookmarkRoot
        'createchild ( "Name User Sees","javascript to change page (0=pg1,1=pg2)","0-based array for children of current BM" )
        BMR.createchild "JOB BOOK FOR TEST JOB 0", "this.pageNum= 0", 0
               
        Dim arrParents, bkmChildsParent
        arrParents = jso.bookmarkRoot.children
        Set bkmChildsParent = arrParents(0)
        bkmChildsParent.createchild "First Topic 0", "this.pageNum= 0", 0
        bkmChildsParent.createchild "Second Topic 1", "this.pageNum= 1", 1

        gPDDoc.SetPageMode 3 '3 — display using bookmarks
        gPDDoc.Save PDSaveIncremental, "C:\Eng2007\JobBook_NEW.pdf"
       
        gPDDoc.Close
       
    End If
   
    Set gPDDoc = Nothing

 

 

 

 

HOWEVER, I am still having some issues.  I know there is SOME decent code out there that deals with JavaScript, but actually executing JavaScript from the VBA seems to be a bit tricky.

 

1.  I cannot figure out the registry location, system variable, etc. in order to fully specify the print to "filename".  I must be able to do this, as report names alone, and default file locations are not sufficient.  I must be able to specify a folder location and exact filename.

 

2.  The open options doesn't seem to be able to be set.  I need to set it to "Fit To Page", displaying Single Page at a Time.  I WAS able to get the file to open with Bookmarks being shown, that's a plus.

 

3.  All of the bookmarks I have added (including hierarchy) can only display using the default view, where I'd like to specify all to be "Fit Page".

 

 

If anyone can use my sample code, please do.  If anyone can provide any help at all....   How to execute a JavaScript statement from VBA, or ANYTHING... it would be greatly appreciated.  I'm currently stuck trying this and that to make things work.  Any examples relating to these issues would be a huge help.

 

Thanks very much in advance...

 

Morgan

How to scroll to old coordinates when user changes page?

$
0
0

I have two pages in my pdf, when user clicks a button(this button is on first page) user moves to the second page using following script.

//document level variable

var oldZoomLevel = this.zoom;

pageNum++;

this.zoom=100;

 

and when the user clicks on other button which is in the second page I am doing

 

pageNum--;

this.zoom=oldZoomLevel;

 

I am able to retain the same zoom level in the first pabe but,

my problem is by default the first page is scrolling to (0,0) coordinates. How to retain to the same scroll position using adobe javascript?

javascript dialog box close button functionality is not working.

$
0
0

I have a button in pdf when the user clicks the button a dialog box appears which has the following buttons.

 

Ok- if pressed go to next page

Cancel- If pressed go to third page

 

But if i press window close button(exit button) it is leading me to third page. How to write destroy event?

PDF Search with SearchExecuteQueryEx and SearchExecuteQuery

$
0
0
I planed to write plagin that would use SearchExecuteQueryEx or SearchExecuteQuery HFT functions exported by Search plagin. Unfortunately SearchExecuteQuery execute successfully but no search performed. It just open the search panel where search textbox contains my keywords only. On the other hand SearchExecuteQueryEx throws exception when I set it's size field with sizeof(SearchQueryDataRec).

My Code sample is as follows :

// declared gSearchHFT as a global veriable

HFT gSearchHFT;

ACCB1 ASBool ACCB2 PluginImportReplaceAndRegister(void)
{
gSearchHFT = ASExtensionMgrGetHFT(ASAtomFromString("Search"),0);
return ( gSearchHFT != NULL)
}

// Include SrchClls.h file where I use SearchExecuteQuery
#include "SrchClls.h"
.
.
.
extern HFT gSearchHFT;
.
.
.
ACCB1 void ACCB2 CallAPISearchExecuteQueryHFT()
{
char* srcTerm = "this";
if (gSearchHFT != NULL)
{
ASBool result = SearchExecuteQuery(srcTerm,kParserCQL,NULL,NULL,NULL,kWordOptionProxi mity || kWordOptionThesaurus, 0,100);
return result;
}
}

ACCB1 void ACCB2 CallAPISearchExecuteQueryHFT()
{
SearchQueryDataRec srcQuery;
srcQuery.size = sizeof(SearchQueryDataRec);
srcQuery.query = (ASText) "this";
srcQuery.type = kSearchActiveDoc;// kSearchActiveDoc;
srcQuery.match = kMatchAnyWords;// kMatchAnyWords;
srcQuery.options = kWordOptionCase;
srcQuery.scope = kSearchBookmarks;
srcQuery.path = NULL;
srcQuery.fs = NULL;
srcQuery.maxDocs = 1;

if (gSearchHFT != NULL)
{
ASBool result;
DURING
result = SearchExecuteQueryEx(&srcQuery);
HANDLER
END_HANDLER
return result;
}
}
Am I missing something or what I need to do... HELP

My Development platform is WindowsXP, Visual Studio 2008, Acrobat Sdk 8, and Acrobat 8.

Thanks in Advance

Can't get color value from DeviceN colorspace

$
0
0

Hi.

I use this code:

 

if (colorSpec.value.colorObj2)

{

    colorValue = (PDEDeviceNColors)colorSpec.value.colorObj2;

    inVals[0] =  ( float )ASFixedTruncToInt32(PDEDeviceNColorsGetColorValue(colorValue, 0));

}

 

When colorspace's stream is {0 0} everything is ok.

 

But then I use colorspace with complex stream:

{ dup 1 mul 2 index 0 mul 2 copy lt { exch } if pop 3 index 0 mul 2 copy lt { exch } if pop 4 index 0 mul 2 copy lt { exch } if pop 5 1 roll dup 0 mul 2 index 1 mul 2 copy lt { exch } if pop 3 index 0 mul 2 copy lt { exch } if pop 4 index 0 mul 2 copy lt { exch } if pop 6 1 roll dup 0 mul 2 index 0 mul 2 copy lt { exch } if pop 3 index 1 mul 2 copy lt { exch } if pop 4 index 0 mul 2 copy lt { exch } if pop 7 1 roll dup 0 mul 2 index 0 mul 2 copy lt { exch } if pop 3 index 0 mul 2 copy lt { exch } if pop 4 index 1 mul 2 copy lt { exch } if pop 8 1 roll pop pop pop pop }

 

In Acrobat 10.0 code still work good. But in Acrobat 11.0 I have Access Violation exception when i try to get color value.

 

Please tell me in what could be the reason.

Automating PDF creation from WORD file with Adobe

$
0
0

We are using the open source Jenkins build server and need to convert of WORD files in subversion to PDF automatically.

Is there a comamnd line tool or VBSCRIPT  that convert word .doc files to PDF? We have Adobe Distiller, Acrobat X Standard & reader.

Is there free tool that can do this via automation?


Silently convert u3d file into PDF using AVConversionConvertToPDF

$
0
0

Hello ,

 

 

     I want to convert u3d file into PDF file and I found an API "AVConversionConvertToPDF" which converts u3d file into PDF but I want this operation should be silent i.e I don't want any UI in this conversion.

     I thought the first parameter of API AVConversionFlags should do that but it won't affect ..

 

 

    Can anyone tell how I can achieve this using AVConversionConvertToPDF or is there any other APIs to do this ?

Issue with length of file paths - Windows & C++ plugin

$
0
0

Hello,

 

I've got an issue that just popped up on my OCR plugin I've been working on that I suspect is related to the length of the filepath.

 

I'm getting the following error that is being caught and logged when trying to open a file (filename changed for security purposes):

Error Opening File: D:\aVeryLongFilePath.pdf

Exception info: This file cannot be found.

 

The entire string, including the D:\ part, is 266 characters long. I cut down the length of part of the path one by one and it was able to open and OCR the document when the length was 259 characters.

 

I know there's a MAX_PATH variable in Windows and/or there's some kind of limitation for file length. Note that I can open the file in Acrobat using File->Open and run OCR on it individually using the built-in Recognize Text function, but if I try to Recognize Text for Multiple files and choose "Add Folders", the file in question doesn't show up in the list of files to be batch OCR'd (even though it is there). Interestingly, choosing "Add Files" from the Recognize Text->In Multiple Files does work. So Acrobat itself has at least some issues opening the file using some of it's features.

 

Here's how I'm opening the document:

 

     string pn;               // assume this is initialized, I'm just putting this here to demonstrate what type it is         pathName = pn;          ASAtom pathType = ASAtomFromString("Cstring");         asPathName = ASFileSysCreatePathName(ASGetDefaultFileSys(), pathType, pn.c_str(), NULL);           pdDoc = PDDocOpen(asPathName, ASGetDefaultFileSys(), NULL, true); 

 

Is there a way around this problem?

 

Thanks.

通过Adobe PDF Reader COM 组件、WinForm 与WPF 集成方面的工具实现PDF 浏览功能的几个问题求助

$
0
0

通过Adobe PDF Reader COM 组件、WinForm 与WPF 集成方面的工具实现PDF 浏览功能。

现在有两个问题没法解决,求帮助!!!!!

(1)怎么全屏显示(隐藏工具栏,滚动条,缩略图,导航栏)?

现在我可以调用:

axAcroPDF1.setView("Fit");

axAcroPDF1.setPageMode("none");

axAcroPDF1.setLayoutMode("SinglePage");

axAcroPDF1.setShowToolbar(false);

axAcroPDF1.setShowScrollbars(false);

可以隐藏工具栏,滚动条,缩略图。但是还是有导航栏存在。我发现CTL+H可以隐藏,但是不需要去按键,在后台代码怎么实现呢,把导航栏也隐藏

 

(2)怎么获取PDF文档的总页数?

我发现只有跳到第一页,最后一页,上一页,下一页的方法,但是没有获取总页数的方法,我怎么判断文档是否浏览到最后一页了呢??

how can i hide navigation panel buttons

$
0
0
Hi, i would like to know how can i remove or hide programatically the navigation panel buttons because i have an applicattion where i open the pdf documents and i don´t want this buttons are shown never.i want that, when the application is open, the buttons don´t be shown. i´m refering to the button on the left of Adobe Reader 8: the botton are "pages", "how to","atachments", and "comments". thanks a lot for your help
susana

Highlighting part of an image using API

$
0
0

Hi,

 

I would like to control Reader using the API from a .NET application. Is it possible to highlight a portion of an image located in the PDF? How can it be done? The document is a historical document handwriten in Arabic and cannot be OCR'd. I want to highlight text extracted using another program.

 

Thank you,

Fatima

Postscript "file" operator restrictions in Distiller 8 and above

$
0
0

According to the Acrobat X SDK Release Notes, "Beginning with Acrobat 8.1, Distiller® restricts the directories that PostScript® file operators can access. The new default behavior limits directory access to the temp and font cache directories. Earlier versions of Distiller allowed PostScript file operators to have unlimited directory access."

 

I'm using Windows XP and I upgraded from Acrobat 7 to Acrobat XI. Under Acrobat 7 I could use Distiller and the Postscrip "file" operator to create TXT files in a directory of my chosing. Now that I'm using Distiller under Acrobat XI, I can no longer do that. I get the following error:

 

%%[ Error: invalidfileaccess; OffendingCommand: file ]%%

Stack:
(w)
(c:\\vfp_temp\\XV0VGM9P.txt)

 

I can modify my program to create the TXT files in the required temp and font cache directories but I don't know where they are located in Windows XP. Does anyone know the location of these two directories on a Windows XP computer?

 

Thanks

PDF document properties Description Additional Metadata update by XMP file.

$
0
0

Hi,

 

  I am using XMP file to append all PDF document properties description by the following steps as shown below.

 

Step 1: File->Document Properties and click Additional Metadata

SC-1.JPG

Step 2: Select Advanced and click Append All

sc-2.JPG

Step 3: Select XMP file from local drive

sc-3.JPG

Step 4: Finally I am getting this result

sc-4.JPG

 

The above steps and process want to be done by automation. I am using Acrobat 7 or 9 with C#.Net.

 

How can do this process by automation? Can I do this by C#.Net or there is any other way but must be in automation.

 

Each PDF file have the separate XMP file.

 

 


 

Regard

 

Thirusanguraja V

 



How to getMouse click position in pdf page

$
0
0

How to getMouse click position in pdf page using acrobat javascript code

Adobepdfl.dll CTBadFontException with Japanese Office 2003

$
0
0

Hello, I am getting a CTBadFontException from CoolType.dll within Adobepdfl.dll(9.2). It only happens occasionally and I was wondering if there is a thread safety issue or multiprocess issue. This is on a Windows 2008 R2(japanese) with Office 2003(japanese). It seems to happen when I have to processes running at the same time.

 

Thank you.

 

 

Stack:

 

'worksrv.exe' (Win32): Loaded 'C:\Windows\SysWOW64\userenv.dll'. Symbols loaded.

'worksrv.exe' (Win32): Loaded 'C:\Windows\SysWOW64\profapi.dll'. Symbols loaded.

First-chance exception at 0x772EB727 in worksrv.exe: Microsoft C++ exception: CTBadFontException at memory location 0x035ECB30.

First-chance exception at 0x772EB727 in worksrv.exe: Microsoft C++ exception: BIB_T::CBIBError at memory location 0x035ED674.

First-chance exception at 0x772EB727 in worksrv.exe: Microsoft C++ exception: _ASExceptionInfo at memory location 0x035EDB08.

First-chance exception at 0x772EB727 in worksrv.exe: Microsoft C++ exception: _ASExceptionInfo at memory location 0x035EDF8C.

First-chance exception at 0x772EB727 in worksrv.exe: Microsoft C++ exception: _ASExceptionInfo at memory location 0x035EDF8C.

First-chance exception at 0x772EB727 in worksrv.exe: Microsoft C++ exception: _ASExceptionInfo at memory location 0x035ED774.

 

>     KernelBase.dll!772eb727()     Unknown

      [Frames below may be incorrect and/or missing, no symbols loaded for KernelBase.dll]     

      CoolType.dll!682e24c5() Unknown

      CoolType.dll!681ec1ec() Unknown

      CoolType.dll!681ffb97() Unknown

      CoolType.dll!681e35ee() Unknown

      CoolType.dll!681e4fe5() Unknown

      CoolType.dll!682a0ba9() Unknown

      Bib.dll!6ac820b1()      Unknown

      CoolType.dll!6829f4c7() Unknown

      AGM.dll!688d2650()      Unknown

      AGM.dll!688d847a()      Unknown

      AGM.dll!68ae549a()      Unknown

      AGM.dll!68b2b017()      Unknown

      AGM.dll!68b2c98c()      Unknown

      AGM.dll!68b2e611()      Unknown

      AGM.dll!68b2fd6c()      Unknown

      AGM.dll!68b318a8()      Unknown

      Bib.dll!6ac820b1()      Unknown

      Bib.dll!6ac8cea5()      Unknown

      Bib.dll!6ac81b80()      Unknown

      Bib.dll!6ac820b1()      Unknown

      Bib.dll!6ac821ae()      Unknown

      Bib.dll!6ac820b1()      Unknown

      Bib.dll!6ac821ae()      Unknown

      AGM.dll!688d2896()      Unknown

      AGM.dll!68b28817()      Unknown

      AGM.dll!68b3933a()      Unknown

      AGM.dll!68b526cd()      Unknown

      AGM.dll!688e7196()      Unknown

      AGM.dll!68907438()      Unknown

      AGM.dll!68aed0a7()      Unknown

      AGM.dll!688d29f4()      Unknown

      Bib.dll!6ac8a36f()      Unknown

      Bib.dll!6ac8ad67()      Unknown

      AGM.dll!68aebe8f()      Unknown

      AGM.dll!68aebf30()      Unknown

      AGM.dll!68aec405()      Unknown

      Bib.dll!6ac8cf32()      Unknown

      Bib.dll!6ac81c01()      Unknown

      Bib.dll!6ac83ecf()      Unknown

      Bib.dll!6ac84b9d()      Unknown

      Bib.dll!6ac84d60()      Unknown

      Bib.dll!6ac84d7d()      Unknown

      AGM.dll!688e7196()      Unknown

      AGM.dll!688d2650()      Unknown

      AGM.dll!688d847a()      Unknown

      AGM.dll!68b32ca3()      Unknown

      AGM.dll!68b1603d()      Unknown

      Bib.dll!6ac8c2c7()      Unknown

      Bib.dll!6acb2e53()      Unknown

      Bib.dll!6ac8c3ab()      Unknown

      AGM.dll!689084cf()      Unknown

      AdobePDFL.dll!690aed89()      Unknown

      AdobePDFL.dll!690b9c86()      Unknown

      AdobePDFL.dll!6906ae52()      Unknown

      AdobePDFL.dll!6906b57e()      Unknown

      AdobePDFL.dll!68f70157()      Unknown

      AdobePDFL.dll!68f70157()      Unknown

      AdobePDFL.dll!68f45f37()      Unknown

      AdobePDFL.dll!68f68407()      Unknown

      AdobePDFL.dll!68f3ec33()      Unknown

Page Resize and set printer brands

$
0
0

Hi all,

 

i'm new on developing with acrobat sdk. I need help on modify the page size and set an printer brand to my pdf document. on sdk documentation or search engines i can't find code samples.

 

i'm developing with c# and i use acrobat xi

 

thanks in advance

Opening PDF in browser using Adobe API - with mark up and comment features

$
0
0

Hey all, 

 

Here is the scenario : Firstly, the user has to review the file (say pdf) before approving it. I would like to open the pdf file in the browser directly for reviewing. Also, I want to add some mark up (sticky notes, highlight text, add stamp tool, underline etc) and comment features to the pdf while reviewing. Using these features, the user can pin point the mistakes directly in the file and revert the file for changes if any. 

 

And as part of implementation, I would like to use Adobe java API to do the same. ( Here is the reference link for what I wanted : http://help.adobe.com/en_US/acrobat/X/standard/using/WS58a04a822e3e501 02bd615109794195ff-7e7f.w.html ) But I couldn't find any code snippets for using this API. 

 

Any kind of help would be appreciated. Thanks in advance.

colorants order when using DeviceN colorspace

$
0
0

Hello everybody,

 

I have an issue when I'm creating PDF with DeviceN colorspace using PDFLibrary.

I define a DeviceN CMYKOG colorspace using Cos objects. I also define each extra colorants in separation colorspace and use those colorants definition in my DeviceN colorspace like this :

 

Device N dict with attribute :

8 0 obj

[/DeviceN[/Cyan/Magenta/Yellow/Black/Orange/Green]/DeviceCMYK 18 0 R 24 0 R]

endobj

 

Attribute dict :

 

24 0 obj

<</Colorants 23 0 R>>

endobj

23 0 obj

<</Green 20 0 R/Orange 22 0 R>>

endobj

 

Then when I use PDFL to list all the colorants, it gives me

Green

Orange

 

When I remove the attribute entry and define my colorspace like this:

Device N dict without attribute :

8 0 obj

[/DeviceN[/Cyan/Magenta/Yellow/Black/Orange/Green]/DeviceCMYK 18 0 R]

endobj

 

when I list the colorants using PDFL it gives me

Orange

Green

 

Like you can see, it is not the same order. And this last order is the one I want to have, and it's important for me to have them in this order.

 

Have you an idea why using colorants definition reverse this order?

I tried using more colorants, and when I use attributes entry for the DeviceN, colorants are always listed in alphabetic order.

I would like to have this separation entry for color convertion in PDF previsualisation, but listed with the order used for DeviceN definition

Viewing all 2571 articles
Browse latest View live


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