English 中文(简体)
Weird problem, with ghostscript and pdf files
原标题:

am using ghostscript to create pdf file from postscript file. My PS file, doesn t have orientation instructions, so when I want to create landscape pdf file, I m using ghostscript to rotate the page. The problem is, that ghostscript rotates only the first page, and when my pdf file is more than 1 page, the others, are not rotated correctly. Here is the command I m using:

cat $psinput | gs -sPAPERSIZE=a4 -sDEVICE=pdfwrite -sOuputFile="/tmp/pdf" 
        -dAutoRotatePages="/None" -c "<< /Orientation 3 >> setpagedevice" 
        90 rotate 0 -595 translate -dNOPAUSE -dEPSCrop  -f - -c -quit

Does anybody have an idea how to correct this?

最佳回答

Without seeing your actual $psinput it is difficult to give definite advice. Your $psinput, coming via stdin to Ghostscript, could contain multiple PS files... Have you tried playing with one of these options

  • -dOrient1=true
  • -dOrient1=false

in your commandline? Also, it looks to me like you should put your 90 rotate 0 -595 translate command inside the quotes going with -c, and then position the input (-f -) to the very end of processing like so:

  • -c "<</Orientation 3>> setpagedevice 90 rotate 0 -595 translate" -f - -c quit

Also have you tried to use

  • -c ".setpdfwrite <<//AutoRotatePages /PageByPage>> setdistillerparams" or
  • -c ".setpdfwrite <<//AutoRotatePages /All>> setdistillerparams" or
  • -c ".setpdfwrite <<//AutoRotatePages /None>> setdistillerparams"

on your commandline (with or without your original rotating code)?

问题回答

If you must not use ghostscript to do the rotation, you can probably use pdftk or impose instead.





相关问题
How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Extract everything from PDF [closed]

Looking for solution to extract content from a PDF file (using console tool or a library). It will be used on server to produce on-line e-books from uploaded PDF files. Need to extract following ...

PDF compression How does Adobe do it?

This is a bit more of a fun question than a serious one, but how does the Adobe PDF format make documents so... portable? I just created a small Word document, 235kb in size, containing multiple ...

Exporting HTML Tables

How can I export an HTML table in my page as PDF and/or XLS? (preferably using JS (+jquery))

Using Java PDFBox library to write Russian PDF

I am using a Java library called PDFBox trying to write text to a PDF. It works perfect for English text, but when i tried to write Russian text inside the PDF the letters appeared so strange. It ...

HTML --> PDF with PHP [duplicate]

Possible Duplicate: Convert HTML + CSS to PDF with PHP? How can I convert an HTML page (via $cURL or something) to a PDF file?

Free way to convert PDF to XPS with C#

Are there any free tools that I can use to convert a PDF document into an XPS document? Although a nice programmatic API would be nice, I m not opposed to shelling out to a command line tool to do ...

PDF conversion service

I need to develop a service able to convert MS Office and Open Office documents to PDF. And the PDF`s also need to be commentable when opened in ADOBE Reader. I have used a piece of software from www....

热门标签