Copy link to clipboard
Copied
Hello All,
i have a problem, i need to export a text box on a page to pdf using javascript. The requirement is that i need to create the pdf with the same dimensions as that of the textbox i.e the height and width of the exported pdf should be same as that of the text box.
I figured a method "exportFile" on the "Textframe" object that is supposed to export an object to a file with the specified format. But using that with a textframe object results in the export of the whole page.
Please help me with the problem
Thanking all in advance.
Copy link to clipboard
Copied
You cannot influence the size of an exported PDF, it's always going to be the page size.
Is that enough to get you on your way?
Copy link to clipboard
Copied
Thanks for your reply Jongware, but could you please tell then what for is the "exportFile" function on textframe do when all it does export the whole page with all the page contents.
Moreover could we do it this way by creating a new page of the size of text box, copying the box over to the new page(dimensions equal to the text box). And then exporting the new page.
Copy link to clipboard
Copied
You can set your app prefs to copy as pdf… Call out to AppleScript or VB to write that clipboard data to file… It worked here…
Copy link to clipboard
Copied
Now that's what I call out of the (application) box thinking!
Copy link to clipboard
Copied
Of course there are no options available to control the pdf data… but 'quick n dirty' pdfs to selection bounds you do get… Or so I do on my mac… can even check that the clipboard data is pdf…
Copy link to clipboard
Copied
Thanks Muppet, this seems to be an excellent workaround but this does not totally meet the requirements. What actually needs to be done is that we need to export a particular textframe to pdf with the same dimension as the dimension of the textframe, also we need to be able to control the quality of the generated pdf by applying a pdf preset.
Do you people think this is possible through scripting sdk or shall i look into the C++ sdk to meet these requirements.
Copy link to clipboard
Copied
Manan,
another idea: you could duplicate the text frame and move it to a brand new InDesign file with the page bounds set to the size of your text frame. Export it from there.
Uwe
Find more inspiration, events, and resources on the new Adobe Community
Explore Now