% letter, but this can be changed to A4 although this is rarely done. ![]() % The default page size for many devices is set at compile time to I searched for PAPERSIZE and found: % Optionally choose a default paper size other than U.S. Upload multiple PS files and batch convert all of them to PDF files without any page or size limit. I catted the second result (since I remembered installing ImageMagick with MacPorts, although if I had to do it again, I'd probably install ImageMagick from source or with HomeBrew instead). Convert PS (PostScript) to PDF documents online free. opt/local/var/macports/software/ghostscript/8.71_3/opt/local/share/ghostscript/8.71/Resource/Init/gs_init.ps I got: /opt/local/share/ghostscript/8.71/Resource/Init/gs_init.ps GS command used is : gs -q -dNOPAUSE -dBATCH -dSAFER -sDEVICEpswrite -sOutputFileoutput1.ps input1.pdf File format conversion to PS is success in majority of the cases but some PDF files are. I saw gs_init.ps, so I quit q and did: sudo find / -name gs_init.ps Hi, I have been using Ghostscript to convert PDF to Postscript (PS) file. Then, n & N to cycle through the results. On my local machine, I did a man gs and then searched for "init" by typing /init and then enter. Īha! The Ghostscript configuration files (Actually, I soon thereafter learned that they're called Ghostscript initialization files.) on the production server must be specifying a different default Ghostscript page size.Īlright, who's the nincompoop that decided (when installing Ghostscript on the production server) to override the default paper size to a4?įortunately, since I don't have production access, I could set it explicitly with -sPAPERSIZE=legal, but I wasn't done investigating things. I thought to myself, why is the production server using a different page size?. that of the PDF generated by my local machine) was slightly larger (In hindsight, I think it was a4.), thus, causing the addition of margin, haha. (In hindsight, I learned this is because ImageMagic delegates PS & PDF formats to Ghostscript anyhow.)Īfter further examination of the production-server generated PDF, I realized that actually the page size of the PDF generated by the production server (vs. Steps to convert PS to PDF in C Create an instance of the Converter class and provide the file PS with the full path Create and set ConvertOptions for PDF. So, I tried using Ghostscript but got the same result. How I came about this solutionįirst, I figured out that I could use ghostscript to convert PostScript (PS) files to PDF. I realized that you can also use the command ps2pdf (which seems nicer) instead of gs, but the above worked fine, so I kept it because I have other more important things to do, and I cannot easily deploy to and test on production. ![]() -dNOPAUSE continues automatically after each page conversion.-dBATCH quits Ghostscript automatically.-dSAFER (readonly) prevents the input file from being changed. ![]() Solution system("gs -dSAFER -dBATCH -dNOPAUSE -sPAPERSIZE=letter -sDEVICE=pdfwrite \
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |