Article 4YWWH ghostscript and writing postscript in a c program.

ghostscript and writing postscript in a c program.

by
latticeguy
from LinuxQuestions.org on (#4YWWH)
Hi,
I'm trying to write a postscript file in a c program. Most is working fine, but now I want
to include material from another file into the output. First I extract the page I want to
insert with
pstopdf -f page -l page -eps pdffile.pdf psfile.eps

Then in the program I have lines like

printf("save\n");
printf("(/pathtofile/psfile.eps) run \n");
printf("restore\n");

Then I proceed to write more postscript.
This works OK, although to see the file I must use "gv -nosafer myfile.ps"

But what I really want to do is have the inserted file fully included in postscript I write, not to be
included at the time the file is run. I tried replacing

printf("(/pathtofile/psfile.eps) run \n");

with

system("cat psfile.eps");

but this gives garbled results. I've tried using sed to remove the directives (lines starting with %%)
from the eps file, and this does work on some files, but not all.

Is there an accepted way to sneak one postscript file inside another?

Mikelatest?d=yIl2AUoC8zA latest?i=eZnRHo8N1Ko:THN95KE0AGQ:F7zBnMy latest?i=eZnRHo8N1Ko:THN95KE0AGQ:V_sGLiP latest?d=qj6IDK7rITs latest?i=eZnRHo8N1Ko:THN95KE0AGQ:gIN9vFweZnRHo8N1Ko
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments