Question

est-il un outil de ligne de commande pour Linux qui me permettra d'annoter un fichier PS ou PDF avec du texte ou une police particulière, la couleur et la taille sans perte de qualité? J'ai essayé de convertir de ImageMagick, et le PDF résultant est de qualité assez médiocre.

J'ai un modèle à l'origine dans Adobe Illustrator, et je voudrais générer des fichiers PDF à partir avec des noms dans certains endroits. J'ai une énorme liste de noms, donc je voudrais le faire dans un lot (non interactive).

Si quelqu'un a des idées que je vous en serais reconnaissant de les entendre. Merci, Carl

Était-ce utile?

La solution

I think it's better to create PDF form and fill it with pdftk fill_form in batch:

$ pdftk form.pdf fill_form data.fdf output out.pdf flatten

Form data should be in Forms Data Format (it's just XML file with field names and values specified).
Note the flatten command. It is required to convert filled form to plain document.

Another way is to create set of PDF documents "with names in certain places" and transparent background, and pdftk stamp each of them over the template:

$ pdftk template.pdf stamp words.pdf output out.pdf

Autres conseils

Another way to accomplish this would be to hack the postscript file itself. It used to be that AI files were postscript files, and you could modify them directly; I don't know if that's true anymore. So you may have to export it.

For simplicity, I assume there's a single page. Therefore, at the very end there will be a single call to showpage (perhaps through another name). Any drawing commands performed before showpage will show up on the page.

You may need to reinitialize the graphics state (initgraphics), as the rest of the document may have left it all funny, expecting showpage to clean up before anyone notices.

To place text, you'll need to set a new font (the old one was invalidated by initgraphics) measure the location in points (72 points/inch, 28.3465 points/cm).

/Palatino-Roman 17 selectfont %so much prettier than Times
x y moveto
(new text) show

To do the merging, you can use perl: emit the beginning of the document as a HERE-document, construct some text-writing lines by program, emit the tail of the document. Here's an example of generating postscript with PERL

Or you can take data from the command-line (with ghostscript) by using the -- option ($gs -q -- program.ps arg1 arg2 ... argn). These arguments are accessible to the program through an array named /ARGUMENTS.

So, say you have a nice graphic of a scary clown holding a blank sign about 1 inch wide, 3 inches tall, top left corner at 4 inches from the left, 4 inches from the bottom. You can insert this code into the ps program, just before showpage.

initgraphics
/Palatino-Roman 12 selectfont
4 72 mul 4 72 mul moveto
ARGUMENTS {
    gsave show grestore 0 -14 rmoveto
} forall

Now you can make him say funny things ($gs -- clown.ps "On a dark," "and stormy night...").

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top