Skip to main content
Participant
December 11, 2023
Question

Mélange aléatoire de pages de fichiers pdf

  • December 11, 2023
  • 3 replies
  • 1605 views

Bonjour,

J'aimerais savoir s'il existe une application/solution pour mélanger aléatoirement les pages d'un fichier pdf pour l'impression de vignettes (pour album de vignettes). 

L'objectif est: à partir d'un fichier de x vignettes ordonnées, générer un fichier de y exemplaires des x vignettes mélangées de façon totalement aléatoire, par exemple, à partir d'un fichier de 200 vignettes ordonnées de 1 à 200, générer un fichier unique pour impression de 50 exemplaires de chacune des 200 vignettes, soit 10.000 pages. Merci d'avance de votre aide. 

 

This topic has been closed for replies.

3 replies

Abambo
Community Expert
Community Expert
December 12, 2023

C'est une requête très bizarre. 

ABAMBO | Hard- and Software Engineer | Photographer
try67
Community Expert
Community Expert
December 12, 2023

Why is it so strange? Imagine you created a file with tickets for a ruffle, and they are all in order (1-100), but you don't want to hand them out in that order. So instead of shuffling the actual pages after you print them (which is difficult to do), you just shuffle the pages in the PDF file, and then print them. Same goes for playing cards, etc. I can think of all kinds of reasons to want to do that.

Participant
December 12, 2023

Exactly, thank you. Many reasons to want to do that. 

try67
Community Expert
Community Expert
December 11, 2023

You can use this code to do it. Change the value of numShuffles to set the number of times the pages are moved around. The higher the number, the more "random" the result will be, but it will also take longer to execute:

 

 

var numShuffles = 1000;
for (var i=1; i<=numShuffles; i++) {
	var sourcePage = Math.floor(Math.random() * this.numPages);
	var targetPage = Math.floor(Math.random() * this.numPages) - 1;
	this.movePage(sourcePage, targetPage);
}

 

Participant
December 12, 2023

Thanks a lot for your answer, looks interesting.

I'm not an expert, so I transmited your answer to my IT expert friend. Hope he understands well. 

try67
Community Expert
Community Expert
December 12, 2023

You can run this code directly from the JS Console (Ctrl+J to open it, paste the code, select it, press Ctrl+Enter to run it), or by inserting it into an Action (Tools - Action Wizard) or a Custom Command in Acrobat Pro.

JR Boulay
Community Expert
Community Expert
December 11, 2023

Qu'appelez-vous "vignette" ?

Ce ne serait pas plus simple d'imprimer directement les pages en réduction ?

Acrobate du PDF, InDesigner et Photoshopographe
Abambo
Community Expert
Community Expert
December 12, 2023

Une vignette est pour moi ce que les anglais appellent "thumbnail".

ABAMBO | Hard- and Software Engineer | Photographer