Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change characteristics of postscript file using vbscript 1

Status
Not open for further replies.

johnnyv

Programmer
Jul 13, 2001
216
CA
Hello
here is my situation: I have a pdf document that is being converted into a postscript document. I need to be able to modify the characteristics of the postscript file. I have figured out how to do some of this using vbscript including orientaion, imposing , scaling of the PS file.

My question
How can I do 2 things
1) insert x # of blank pages to the end of the postscript file, currently the file is single sided pages from 10-80 pages in length. I need to add up to 3 blank pages to the end of the document

2) I need to be able to reorder the pages in the PS file
ie if the document is 4 pages in length
page 1 will become page 4
page 2 will stay page 3
page 3 becomes page 2
page 4 becomes page 1

any ideas

thanks for any replys
 
Issue #1 is easy: the "showpage" operator generates new pages. For three pages, invoke 3 showpages. Or you can do this in a repeat loop:

Code:
3 {showpage} repeat

Issue #2 is so hard you should consider it impossible, unless you're willing to do some major file i/o and understand a lot of PostScript fundamentals. It also pre-supposes that the PostScript generated will conform exactly to DSC formatting, in which each page is a self-contained unit.

Why wouldn't pages be self-contained? So my code-snippet above! How you would "separate" those three pages? You'd have to unroll the loop.

That said, if you're generating your PostScript from Adobe, it will likely conform to DSC, which is a formalized commenting structure.

There will be a prolog, marked by such statements as "%%BeginSetup" and "%%EndSetup". Process the entire prolog first... in other words, leave it where it is.

Next, each page should be bracketed by %%BeginPage and %%EndPage comments. You're file io should be to find the last %%EndPage, read backwards until you find $$BeginPage, and write that block into your new file. Etc.

Make sense?

Thomas D. Greer
 
thanks for the reply tgreer problem #1 solved. Thanks
problem # 2 I am a rookie at postscript so it sounds like Ineed to come at this problem from another angle

thanks for your help
 
Your other angle could be to work directly with the PDF file itself. Acrobat 6.0 provides a JavaScript implementation, and one of the methods is to insert and delete pages. You could create a "blank" PDF, open both, and traverse the Source PDF backwards, inserting pages into the new PDF as you go.

Now be a good fellow and mark my posts helpful. I've got a reputation to maintain. ;)

Thomas D. Greer
 
thanks again for the reply tgreer

most helpful 2 stars for you. I will have to take a look at the Javascript option and see where it gets me, thanks again
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top