Copy link to clipboard
Copied
Hi !
I want to ad a security for the PDF I creat with my Export script.
You can open the PDF, print it, put no edit it with InDesign or Illustrator etc...
Can you help me please ?
Thank you ![]()
Copy link to clipboard
Copied
See here and search for the word security
Adobe InDesign CS5 (7.0) Object Model JS: PDFExportPreference
Copy link to clipboard
Copied
I've try to use it... but whitout succed 😕
Can you tell me how to use it correctly ?
Thank you ![]()
Copy link to clipboard
Copied
Try this ...
var myPDF = new File('~/desktop/foo3.pdf');
with (app.pdfExportPreferences)
{
pageRange = PageRange.ALL_PAGES;
useSecurity = true;
disallowChanging = true;
disallowCopying = true
disallowDocumentAssembly = true;
disallowExtractionForAccessibility = true;
disallowFormFillIn = true;
disallowHiResPrinting = true;
disallowNotes = true;
disallowPlaintextMetadata = true;
disallowPrinting = false;
}
app.activeDocument.exportFile(ExportFormat.pdfType, myPDF, false);
Copy link to clipboard
Copied
Where i place it ?
Copy link to clipboard
Copied
Look the snippet ...
1°) change PDF Export preferences
2°) export PDF
Copy link to clipboard
Copied
Hi, now it's different, I want to put this same option but, only when the computeur is not connected to my serveur.
So, when you are in the serveur, you can do what you want with the PDF, ans when you're not, you can juste open, copy and print it.
It's urgent, help me please ![]()
Thank you ![]()
That's my actual code :
app.activeDocument.dataMergeProperties.mergeRecords();
var myDocument = app.activeDocument;
main();
function main(){
exportPDF();
}
function exportPDF(){
var myPageName, myFilePath, myFile;
var myPDFExportPreset = app.pdfExportPresets.item("[Qualité supérieure]");
for(var myCounter = 0; myCounter < myDocument.pages.length; myCounter++){
myPageName = myDocument.pages.item(myCounter).name;
app.pdfExportPreferences.pageRange = myPageName;
var myRegExp = /:/gi;
myPageName = myPageName.replace(myRegExp, "_");
myFilePath = "//TE-srv/hrx/02_JUY_CDSC" + "/" + extractPAFname(myCounter) + ".pdf";
myFile = new File(myFilePath);
if(!myFile.exists){
myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFExportPreset);
}else{
var mConfirm= confirm ('Le document ' + extractPAFname(myCounter) + ' existe déjà, voulez-vous le remplacer ?', 'Document existant');
if (mConfirm){
myDocument.exportFile(ExportFormat.pdfType, myFile, false, myPDFExportPreset);
}
}
}
}
function extractPAFname(AllPages){
var myStyle = myDocument.paragraphStyles.itemByName('nom_fichier');
if (myStyle.isValid){
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findGrepPreferences.appliedParagraphStyle = myStyle;
var mySearch = myDocument.findGrep();
if (mySearch.length >0){
return mySearch[AllPages].contents
}else {
alert('Erreur - Pas de texte');
exit();
}
}else {
alert('Erreur - Pas de style');
exit();
}
}
Copy link to clipboard
Copied
So, when you are in the serveur, you can do what you want with the PDF, ans when you're not, you can juste open, copy and print it.
That's not how the PDF security options work. They are stored inside the file, and it does not matter where the file is stored.
Copy link to clipboard
Copied
I think I don't used the correct word sorry ![]()
It's not possible to protect the file when an user outside the network use it, if this user is not in the network, I can just open, copy and print it.
That's possible ?
Thank you ![]()
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more