Skip to content

Commit bfcedd6

Browse files
committed
fix(document): export document
1 parent 0b26e26 commit bfcedd6

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

photoshop/api/_document.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323

2424
# Import third-party modules
2525
from comtypes import COMError
26+
import pythoncom
2627

2728
# Import local modules
2829
from photoshop.api._artlayer import ArtLayer
@@ -348,9 +349,7 @@ def crop(
348349
"""
349350
return self.app.crop(bounds, angle, width, height)
350351

351-
def exportDocument(
352-
self, file_path: str, exportAs: ExportType = None, options: Union[ExportOptionsSaveForWeb] = None
353-
):
352+
def exportDocument(self, file_path: str, exportAs: ExportType, options: Union[ExportOptionsSaveForWeb]):
354353
"""Exports the Document.
355354
356355
Note:
@@ -362,12 +361,7 @@ def exportDocument(
362361
363362
"""
364363
file_path = file_path.replace("\\", "/")
365-
scripts = f"""
366-
var file = new File("{file_path}");
367-
{options.as_javascript()}
368-
app.activeDocument.exportDocument(file, ExportType.{exportAs.name.upper()}, opts)
369-
"""
370-
return self.eval_javascript(scripts)
364+
self.app.export(file_path, exportAs, options)
371365

372366
def duplicate(self, name=None, merge_layers_only=False):
373367
return Document(self.app.duplicate(name, merge_layers_only))

0 commit comments

Comments
 (0)