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

[JS] PageItem Export to PNG: exported image's dimesion is different from PageItem's

Community Beginner ,
Sep 03, 2012 Sep 03, 2012

Copy link to clipboard

Copied

When I try to export a rectangular text frame to PNG with JavaScript, the result PNG image may have bigger dimension than that of the text frame itself in InDesign. I believe this has something to do with the line height of the text.

Is there any Export option I can use to make the exported image's dimension the same as the text frame's?

Please see my attached pictures for an example:

  • The text frame in InDesign has a dimension of 400 x 80 (pixels)

frame.png

  • This is the exported PNG, which has a dimesion of 400 x 96 (pixels). Notice the padding at the top and bottom of the image.

real-dimension.png

TOPICS
Scripting

Views

8.4K

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

correct answers 1 Correct answer

Community Expert , Sep 05, 2012 Sep 05, 2012

Hmm -- moving any item "into" a rectangle is not a straightforward operation. Well, let's (ab)use "app.copy" and "app.paste" then, although, theoretically at least, it should be possible by manipulating the objects.

This duplicates the selected item, removes its contents, sets stroke and fill to none, and then pastes the original selection into the new one. After exporting, the duplicated object automatically gets deleted so you end up with what you started with.

(Warning! Tested only with CS4!)

ob

...

Votes

Translate

Translate
Guide ,
Oct 17, 2014 Oct 17, 2014

Copy link to clipboard

Copied

LATEST

Hello,

Did any one find a result for this?

I am writing a script to export to Baker framework and it would be really handy to have a script fix for this. I have got some a approximations on the extra space, but that really is not good enough.

I can / have write a C++ plugin, but that would make my script dependent on my plugin.

All the best.

P.

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