Issue with SetTitle for Acrobat Pro 2017

New Here ,
Oct 12, 2017

Copy link to clipboard

Copied

In some of my company's applications, we open up the PDF via code and set the title as something more descriptive than the file name. This has worked for both Acrobat 9 and Acrobat DC. We're now looking to switch to Acrobat 2017, and it looks like for some computers it works (except the title disappears when focus is lost) and some computers the Acrobat will error out. Does anyone know a workaround?

Below, the steps I can take to produce the error and the sample code that opens it up

SAMPLE STEPS

  1. Opening a PDF via an application and set title (see sample code)
  2. View PDF
  3. Lose focus of PDF
  4. Go back to PDF (title switches to GUID)
  5. Close PDF
  6. Opening a PDF via an application and set title (see sample code)

    Get the following error


    Debugging I see

    Unhandled exception at 0x5F696E3D (Acrobat.dll) in Acrobat.exe: 0xC0000005: Access violation writing location 0x00000014. occurred

SAMPLE CODE BELOW

public static void OpenFile(int handle, string pdfLocation, string description)

{

var gAppClass = new Acrobat.AcroApp();

var avDOC = new Acrobat.AcroAVDoc();

OpenAvDoc(handle, avDOC, pdfLocation);

avDOC.BringToFront();

gAppClass.Show();

  avDOC.SetTitle(description);

}

private static bool OpenAvDoc(int handle, Acrobat.AcroAVDoc avDOC, string pdfLocation)

{

bool result = false;

// if no foreground, or couldn't open window, open normally.

if (handle <= 0 || !avDOC.SetViewMode(0))

{

result = avDOC.Open(pdfLocation, "");

}

else

{

try

{

result = avDOC.OpenInWindowEx(pdfLocation, handle, (int)Acrobat.AVOpenParams.AV_PAGE_VIEW, 1, 0, (short)Acrobat.PDViewMode.PDUseNone, (int)Acrobat.AVZoomType.AVZoomFitWidth, 0, (short)9999, (short)9999);

}

catch

{

result = avDOC.Open(pdfLocation, "");

}

}

return result;

}

TOPICS
Acrobat SDK and JavaScript

Views

331

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Issue with SetTitle for Acrobat Pro 2017

New Here ,
Oct 12, 2017

Copy link to clipboard

Copied

In some of my company's applications, we open up the PDF via code and set the title as something more descriptive than the file name. This has worked for both Acrobat 9 and Acrobat DC. We're now looking to switch to Acrobat 2017, and it looks like for some computers it works (except the title disappears when focus is lost) and some computers the Acrobat will error out. Does anyone know a workaround?

Below, the steps I can take to produce the error and the sample code that opens it up

SAMPLE STEPS

  1. Opening a PDF via an application and set title (see sample code)
  2. View PDF
  3. Lose focus of PDF
  4. Go back to PDF (title switches to GUID)
  5. Close PDF
  6. Opening a PDF via an application and set title (see sample code)

    Get the following error


    Debugging I see

    Unhandled exception at 0x5F696E3D (Acrobat.dll) in Acrobat.exe: 0xC0000005: Access violation writing location 0x00000014. occurred

SAMPLE CODE BELOW

public static void OpenFile(int handle, string pdfLocation, string description)

{

var gAppClass = new Acrobat.AcroApp();

var avDOC = new Acrobat.AcroAVDoc();

OpenAvDoc(handle, avDOC, pdfLocation);

avDOC.BringToFront();

gAppClass.Show();

  avDOC.SetTitle(description);

}

private static bool OpenAvDoc(int handle, Acrobat.AcroAVDoc avDOC, string pdfLocation)

{

bool result = false;

// if no foreground, or couldn't open window, open normally.

if (handle <= 0 || !avDOC.SetViewMode(0))

{

result = avDOC.Open(pdfLocation, "");

}

else

{

try

{

result = avDOC.OpenInWindowEx(pdfLocation, handle, (int)Acrobat.AVOpenParams.AV_PAGE_VIEW, 1, 0, (short)Acrobat.PDViewMode.PDUseNone, (int)Acrobat.AVZoomType.AVZoomFitWidth, 0, (short)9999, (short)9999);

}

catch

{

result = avDOC.Open(pdfLocation, "");

}

}

return result;

}

TOPICS
Acrobat SDK and JavaScript

Views

332

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 12, 2017 0
Glen20j LATEST
New Here ,
Apr 18, 2018

Copy link to clipboard

Copied

I have exactly the same problem with Acrobat DC,  it works with earlier version of acrobat pro just not the DC version.  Crash always occurs on the second open of pdf after closing the first.

any workaround for this Chris?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 18, 2018 0