• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Acrobat DC SDK crash in PDPageDrawContentsToWindow

Community Beginner ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

I have inherited an Acrobat plugin which displays 1-n PDF pages in an offline bitmap using PDPageDrawContentsToWindow, in addition to displaying 1 PDF page in the main Acrobat window. The offline bitmap shows imposed output.

This is a Windows only plugin, not targeting Acrobat Reader.

Certain PDF files crash the DC SDK plugin version, but work fine in the Acrobat XI plugin version. Other PDFs are fine in the DC SDK plugin. The crash is always in PDPageDrawContentsToWindow. There is no consistency as to whether the 1st or n-th page rendered to the offline bitmap crashes PDPageDrawContentsToWindow.

In all cases, the PDF page displays fine in the main Acrobat window and there is no indication the PDFs are corrupt (Acrobat does not ask to save the files, syntax preflighting passes, etc.)

I have looked at the "What's new" document, but there doesn't seem to be significant changes from XI SDK to DC SDK.

I have changed the plugin to wait for the AVPageViewDidDraw notification before starting to use PDPageDrawContentsToWindow, but the behavior did not improve.

Does anyone have any suggestions as to where to look?

The PDFs causing the crash have some large images (e.g. 6000x2400, 5400x3700) and some are part of transparency regions - but that is about the extent of the 'common thread' between them.

TOPICS
Acrobat SDK and JavaScript

Views

1.2K

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
community guidelines
Adobe Employee ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

Are you bracketing the calls with DURING/HANDLER blocks? I wonder if this is an exception being thrown that you are not catching vs. an actual crash in our code…

Votes

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
community guidelines
Community Beginner ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

Hi,

Thanks for the reply. I will investigate that, but allow me to emphasize that the code, as is, runs without crashes with the Acrobat XI SDK.

So my first reaction is that something in the SDK has changed (and I am unable to figure out what from the documentation).

Votes

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
community guidelines
Adobe Employee ,
Jun 19, 2018 Jun 19, 2018

Copy link to clipboard

Copied

Sure, the code in Acrobat has changed. What is going on in this case, can’t tell without a file.

If you want to post the file that is causing problems, we can investigate…

Votes

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
community guidelines
LEGEND ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

You say the DC SDK is crashing. Do you mean the crash depends on the version of the SDK, not Acrobat? Or are you actually saying that the same plugin and SDK crashes Acrobat DC but not Acrobat XI?

In any case please post the exact dot version of DC. Please don’t say “latest”!

Votes

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
community guidelines
Community Beginner ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Hi Test Screen Name,

- Plugin compiled with VisualStudio 2010 and Acrobat XI SDK running in Acrobat XI (11.0.07) works

- Plugin compiled with VisualStudio 2010 and Acrobat DC SDK running in Acrobat DC (2017.011.30080) crashes

I believe there is only 1 version of the DC SDK available for download (circa 2015? - may be wrong on that date)

Hope this clarifies the situation.

Votes

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
community guidelines
Community Beginner ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Hi lrosenth,

Just to be clear - are you asking for the PDF(s) that cause crashes or the plugin code?

I can post the PDFs, and additional detail re: parameters for PDPageDrawContentsToWindow.

Unfortunately, posting plugin code is not going to work as the plugin relies on interface/dialog with a 'back end' process which provides information about the imposition of PDF pages to be shown in the external window.

BTW, I cannot find a plugin example using PDPageDrawContentsToWindow in the SDK. Is there one somewhere?

Votes

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
community guidelines
Adobe Employee ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Just a PDF that causes the crash please…

And, as noted in the other thread, the version of Acrobat…

Votes

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
community guidelines
Community Beginner ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Hi lrosenth,

To make it clearer what should happen:

- Here are parameters for PDPageDrawContentsToWindow and code snippets:

PDF page 1

Matrix 0.0784228 0 0 -0.0784228 306.953 90.3876                    

UserSpaceClipBox x -3914.08 y -4700.32 w 7421.31 h 5852.89

PDF page 2                        

Matrix 0.0784228 0 0 -0.0784228 306.953 183.643        

UserSpaceClipBox x -3914.08 y -3511.19 w 7421.31 h 5852.89

PDF page 3                        

Matrix 0.0784228 0 0 -0.0784228 306.953 276.898        

UserSpaceClipBox x -3914.08 y -2322.05 w 7421.31 h 5852.89

PDF page 4                        

Matrix 0.0784228 0 0 -0.0784228 306.953 370.153        

UserSpaceClipBox x -3914.08 y -1132.92 w 7421.31 h 5852.89

Code snippets:

ASFixedMatrix matrix;

matrix.a = ASFloatToFixed( matTargetCTM.a );

matrix.b = ASFloatToFixed( matTargetCTM.b );

matrix.c = ASFloatToFixed( matTargetCTM.c );

matrix.d = ASFloatToFixed( matTargetCTM.d );

matrix.h = ASFloatToFixed( matTargetCTM.e );

matrix.v = ASFloatToFixed( matTargetCTM.f );

ASFixedRect updRect;

updRect.left   = ASFloatToFixed( UserSpaceClipBox.pt.x );

updRect.bottom = ASFloatToFixed( UserSpaceClipBox.pt.y );

updRect.right  = ASFloatToFixed( UserSpaceClipBox.pt.x + UserSpaceClipBox.w );

updRect.top    = ASFloatToFixed( UserSpaceClipBox.pt.y + UserSpaceClipBox.h );

PDPageDrawContentsToWindow (page,

                            NULL, //hDC used

                            hDC,

                            false,

                            &matrix,

                            &updRect,

                            NULL, // cancel proc

                            NULL);// cancel proc data

- Here is an image of the plugin working in Acrobat XI

AcrobatXI-pluginOK.JPG

- Here is an image of the plugin crashing in Acrobat DC (seems to be always on the 2nd page)

AcrobatDC-pluginCrash.JPG

- Uploading the PDF.... I don't know how. The example above is 117 MB. The other PDF which reliably crashes is 23 MB. Both exceed the "Insert image" limit of 8.x MB. (And I don't know if "Insert Image" is the right mechanism).

Votes

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
community guidelines
LEGEND ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

You can't insert PDF files as images anyway...you need to share it some other way and post the URL. Remember this is a public forum.

Votes

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
community guidelines
Community Beginner ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Can you see this?

meter.pdf - Google Drive

Votes

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
community guidelines
Adobe Employee ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Yes, thanks!

I am not using your exact parameters (and not in your exact calling sequence, of course) – but I have no problem rendering all pages of that PDF to a raster using the current version of Acrobat DC (Windows). It may not impact you, but the PDPageDrawContentsToWindow has been deprecated since it doesn’t work on Mac OS any longer. You want to consider rasterizing it to a bitmap/raster and then blitting that yourself into a window…

Votes

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
community guidelines
Community Beginner ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

OK, thanks for looking into this. My summary is:

- "PDPageDrawContentsToWindow has been deprecated". Is that as of Acrobat DC SDK? Documentation of DC SDK does not mention deprecation.

- "Uploaded file renders to raster". Did you use PDPageDrawContentsToMemory? Save as->TIFF in Acrobat?

Votes

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
community guidelines
Adobe Employee ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

LATEST

As of Acrobat DC itself – SDK may not reflect this. (API is there and will continue to work, we just recommend using some of the other PDPageDraw APIs)

I used PDPageDrawContentsToMemory()

Votes

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
community guidelines
LEGEND ,
Jun 20, 2018 Jun 20, 2018

Copy link to clipboard

Copied

Looks like that will work. Won't be useful for me to analyze unfortunately.

Votes

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
community guidelines