Hello !
Je me pose une question depuis plusieurs mois/années, et malgré plusieurs sessions de recherche je n'arrive pas à trouver mon bonheur.
J'aimerais pouvoir, depuis le Finder, et en faisant le moins de manipulations possibles, convertir un doc Pages en PDF. Que ce soit un export, une impression, je pense que dans mon cas ça ne change pas grand-chose.
Je me suis déjà plus ou moins frotté à Automator, à Apple Script, aux commandes dans le Terminal, mais je n'ai jamais vraiment réussi à trouver quelque chose qui fonctionne =(
Dans l'idéal, j'aimerais que ça puisse apparaître dans un menu contextuel, ou sous la forme d'une application sur laquelle je n'ai qu'à glisser un ou plusieurs documents.
J'ai cru m'approcher du Graal en allant jeter un oeil ici : https://discussions.apple.com/thread/7915966
Malheureusement, lorsque j'ai mon application Pages2PDF et que je glisse un fichier dessus, je vois bien que quelque chose se lance furtivement dans le dock, mais il ne se passe rien d'autre... Pas de fichier créé, pas de message d'erreur =(
Merci pour votre aide, ça serait vraiment cool que j'arrive enfin à trouver une solution pour faire ça !
Je vous copie le script que j'ai essayé d'enregistrer en tant qu'application :
-- pages2PDF.applescript
--
-- Drag and drop solution where you can drop a file(s), and/or folder(s) of Pages documents
-- and they will all export as PDF in their present filesystem location. If the Pages version
-- is 5.6 or later, export the documents as Best quality.
-- Restriction: Pages v5 or later only
-- Version 1.0, Tested: macOS Sierra 10.12.4, Pages v6.1
-- VikingOSX, 2017-04-07, Apple Support Communities
property pages_kind : {"Pages Publication"}
on open dropped_items
repeat with anItem in dropped_items
try
tell application "Finder" to set akind to kind of anItem
if akind contains "Folder" then
tell application "Finder"
set docList to (every item in entire contents of folder anItem whose kind is in pages_kind) as alias list
end tell
repeat with afile in docList
export_file(afile)
end repeat
else if akind is in pages_kind then
export_file(anItem)
end if
on error errmsg number errnbr
my error_handler(errnbr, errmsg)
tell application "Pages" to if it is running then quit
return
end try
end repeat
end open
return
on export_file(theFile)
tell application "Finder" to set name_ext to name extension of theFile
set exportDocument to text 1 thru ((offset of name_ext in (theFile as text)) - 1) of (theFile as text) & "pdf"
-- Permissions error fix for Sierra < 10.12.4, and Pages v6, v6.0.5
close access (open for access exportDocument)
tell application "Pages"
try
set mydoc to open theFile
with timeout of 1200 seconds
if (version of it) ≥ "5.6" then
set export_quality to (Best as constant)
export mydoc to file exportDocument as PDF with properties {image quality:export_quality}
else
export mydoc to file exportDocument as PDF
end if
end timeout
close mydoc saving no
on error errmsg number errnbr
my error_handler(errnbr, errmsg)
tell application "Pages" to if it is running then quit
return
end try
end tell
tell application "Finder"
if exists (file exportDocument as alias) is true then
set extension hidden of (file exportDocument as alias) to false
end if
end tell
return
end export_file
on error_handler(nbr, msg)
return display alert "[ " & nbr & " ] " & msg as critical giving up after 10
end error_handler
C'est pas ce qu'il y a de plus élégant, mais j'ai ça qui fait le taff ; enregistré en mode "Quick Action" ça me permet de faire ce que je veux. En attendant d'être pimpé un p'tit coup !
on run {input, parameters}
repeat with theFile in input
tell application "Finder"
set theFilesFolder to (folder of theFile) as text
end tell
tell application "Pages"
set theDoc to open theFile
set theDocName to name of theDoc
set theName to (characters 1 thru -7 of theDocName) as text
export theDoc as PDF to file ((theFilesFolder & theName & ".pdf") as text)
close theDoc
end tell
end repeat
return input
end run
J'ai l'onglet "exporter vers PDF" directement dans le menu Pages -- Fichier !
Mon objectif c'est de pouvoir faire ça en série, sans avoir à ouvrir chaque fichier dans Pages.
hmmm, salut
J'utilisais ce vieux truc y'a un bail
http://tyorex.com/iWorkConverter/
Pas forcement ce que tu veux mais si jamais...
++