soundofheaven.info Technology GHOSTSCRIPT PRINT PDF

Ghostscript print pdf

Friday, April 12, 2019 admin Comments(0)

An interpreter for the PostScript language and for PDF. Releases and Release History. The leading edge of Ghostscript development is under the GNU Affero. Some printers can print at several different resolutions, letting you balance resolution gs -sDEVICE=pdfwrite -o soundofheaven.info examples/soundofheaven.info -c "<< / OutputFile. This logic will print PDF documents, using GhostScript, without opening or using Adobe. You will need to have Ghostscript installed on the local.


Author: CHRISTIE WILTGEN
Language: English, Spanish, Hindi
Country: Haiti
Genre: Children & Youth
Pages: 770
Published (Last): 07.12.2015
ISBN: 569-1-54195-509-5
ePub File Size: 27.65 MB
PDF File Size: 17.29 MB
Distribution: Free* [*Regsitration Required]
Downloads: 34310
Uploaded by: FLOYD

I've finally made it working and easy for debugging. My final method code for those interested: /// /// Prints the PDF. /// ///

To preserve the case of switches, quote them like this:. The value is platform dependent. The general form supported is:. For instance, to direct all output into the file ABC. MS Windows The name of the Ghostscript command line executable on MS Windows is gswin32c so use this instead of the plain ' gs ' in the quickstart examples. Client application rasterizes it into a window. Where the two resolutions are same, as is the common case, you can simply use -r res.

Start learning today for free Move Your Career Forward with certification training in the latest technologies. Start your trial today.

Scripting Languages From novice to tech pro — start learning today. Web Development. Gregor Dzierzon. Members can enroll in this course at no extra cost. Adam Barney. Alex Garrett. Brett Hooper. Scripting Languages. Chris Penick. Brigitte Birze. Business Management. Martin VanDerSchouw. Microsoft Applications. Patrick Loner. Ken Mayer. All rights reserved. Covered by US Patent. Privacy Policy Terms of Use. Licenced CPOL. Thomas Cooper , 28 Sep Rate this: Please Sign up or sign in to vote.

OpenSubKey applicationKey ; if key! GetValue " ". OpenSubKey item ; foreach var valueInner in inner. GetValue valueInner. ToString ; if! Contains ". Combine inner1, " gswin32c. Empty, String. Item1, s. Item2 ; if! IsNullOrEmpty allocatedPath.

Item2; getPrinterName ; setTracking ; if! WriteLine " Process started" ; Console. WriteLine " Process Id: Note that Ghostscript does not use this file searching algorithm for the run or file operators: To run a file using the searching algorithm, use runlibfile instead of run. Adobe specifies that resources are installed in a single directory. Ghostscript instead maintains a list of resource directories, and uses an extended method for finding resource files.

The search for a resource file depends on whether the value of the system parameter GenericResourceDir specifies an absolute path. The user may set it as explained in Resource-related parameters.

The first path with Resource in it is used, including any prefix up to the path separator character following the string Resource. If the value of the system parameter GenericResourceDir is an absolute path the default , Ghostscript assumes a single resource directory.

It concatenates:. If the value of the system parameter GenericResourceDir is not an absolute path, Ghostscript assumes multiple resource directories. In this case it concatenates:. Due to possible variety of the part 1, the first successful combination is used. For example, if the value of the system parameter GenericResourceDir is the string.. So in this example, if the user on a Windows platform specifies the command line option -I.

The string.. In the case of multiple resource directories, the default ResourceFileName procedure retrieves either a path to the first avaliable resource, or if the resource is not available it returns a path starting with GenericResourceDir.

Consequently Postscript installers of Postscript resources will overwrite an existing resource or add a new one to the first resource directory.

To look up fonts, after exhausting the search method described in the next section , it concatenates together. Note that even although the system parameters are named "somethingDir", they are not just plain directory names: Ghostscript has a slightly different way to find the file containing a font with a given name. See the documentation of fonts for details.

Print pdf ghostscript

Then, when Ghostscript needs to find a font that isn't already loaded into memory, it goes through a series of steps. CID fonts e. Chinese, Japanese and Korean are found using a different method.

SGI in place of Fontmap or Fontmap.

It says: We think this problem has been fixed in Ghostscript version 6. See Fontmap. Sol instead. Also, on Solaris 2. The fonts Sun distributes on Solaris 2. These paths may not be exactly right for your installation; if the indicated directory doesn't contain files whose names are familiar font names like Courier and Helvetica, you may wish to ask your system administrator where to find these fonts.

Adobe Acrobat comes with a set of fourteen Type 1 fonts, on Unix typically in a directory called There is no particular reason to use these instead of the corresponding fonts in the Ghostscript distribution which are of just as good quality , except to save about a megabyte of disk space, but the installation documentation explains how to do it on Unix.

CID fonts are PostScript resources containing a large number of glyphs e. Please refer to the PostScript Language Reference, third edition, for details. CID font resources are a different kind of PostScript resource from fonts. In particular, they cannot be used as regular fonts. CID font resources must first be combined with a CMap resource, which defines specific codes for glyphs, before it can be used as a font. This allows the reuse of a collection of glyphs with different encodings.

Another method is possible using the composefont operator.

Creating PDF files with GhostScript

They are not found using Font lookup on the search path or font path. In general, it is highly recommended that CIDFonts used in the creation of PDF jobs should be embedded or available to Ghostscript as CIDFont resources, this ensures that the character set, and typeface style are as intended by the author. In cases where the original CIDFont is not available, the next best option is to provide Ghostscript with a mapping to a suitable alternative CIDFont - see below for details on how this is achieved.

As shipped, this uses the DroidSansFallback. This font contains a large number of glyphs covering several languages, but it is not comprehensive. There is, therefore, a chance that glyphs may be wrong, or missing in the output when this fallback is used.

As with any font containing large numbers of glyphs, DroidSansFallback. If this is space you cannot afford in your use of Ghostscript, you can simply delete the file from: The build system will cope with the file being removed, and the initialization code will avoid adding the internal fall back mapping if the file is missing. If DroidSansFallback. As the name suggests, this will result in all the glyphs from a missing CIDFont being replaced with a simple bullet point.

This type of generic fall back CIDFont substitution can be very useful for viewing and proofing jobs, but may not be appropriate for a "production" workflow, where it is expected that only the original font should be used. For this situation, you can supply Ghostscript with the command line option: The file forms a table of records, each of which should use one of three formats, explained below. Note that the default Ghostscript build includes such configuration and resource files in a rom file system built into the executable.

So, to ensure your changes have an effect, you should do one of the following: Please pay attention that both them must be designed for same character collection. The trailing semicolon and the space before it are both required. If the array consists of 2 elements, the first element is a string, which specifies Ordering ; the second element is a number, which specifies Supplement.

If the array consists of 3 elements, the first element is a string, which specifies Registry ; the second element is a string, which specifies Ordering ; the third element is a number, which specifies Supplement.

The TrueType font must contain enough characters to cover an Adobe character collection, which is specified in Ordering and used in documents. It is also possible to influence the path using standard, or your own environment variables, using the custom Postscript operator getenv. Said operator takes a string parameter on the stack which is the environment variable to interrogate, and returns either a string, containing the value of the environment variable, and boolean true to indicate success, or just a boolean false to indicate failure.

See below for an example of its use. The script can also be run separately e.

Print pdf ghostscript

Note that the font file path uses Postscript syntax. Because of this, backslashes in the paths must be represented as a double backslash. This can complicate substitutions for fonts with non-Roman names. This cannot be used directly in a cidfmap file because the xx notation in names is a PDF-only encoding.

Instead, try something like:. This lets you specify a name using any sequence of bytes through the encodings available for Postscript strings. There is no reliable way to generate a character ordering for truetype fonts. The 7. This is replaced in the 8. As a workaround the PDF interpreter applies an additional substitution method when a requested CID font resource is not embedded and it is not available.

The latter may look some confusing for a font name, but we keep it for compatibility with older Ghostscript versions, which do so due to a historical reason. If the CID font file is not embedded, the Adobe-Identity record depends on the document and a correct record isn't possible when a document refers to multiple Far East languages.

In the latter case add individual records for specific CID font names used in the document. Ghostscript can handle True Type fonts with the full Unicode character set. For doing that, a third-party software should generate a Postscript or PDF document with a text, which is encoded with the UTF encoding.

Ghostscript currently doesn't do a very good job of deleting temporary files if it exits because of an error; you may have to delete them manually from time to time. The original PostScript language specification, while not stating a specific word sise, defines 'typical' limits which make it clear that it was intended to run as a bit environment. Ghostscript was originally coded that way, and the heritage remains within the code base.

This is the only real purpose in adding support for large integers, however since that time, we have made some efforts to allow for the use of bit words; in particular the use of integers, but also lifting the 64K limit on strings and arrays, among other areas. Even when the build supports bit words, you should be aware that there are areas of Ghostscript which do not support bit values.

Sometimes these are dependent on the build and other times they are inherent in the architecture of Ghostscript the graphics library does not support bit co-ordinates in device space for example, and most likely never will. Note that the extended support for bit word size can be disabled by executing 'true. The Ghostscript distribution includes some Unix shell scripts to use with Ghostscript in different environments. These are all user-contributed code, so if you have questions, please contact the user identified in the file, not Artifex Software.

For instance,. If the "directory" name ends with a closing square bracket " ] ", it is taken to refer to a real directory, for instance. To preserve the case of switches, quote them like this:. If you are using on an X Windows display, you can set it up with the node name and network transport, for instance.

The name of the Ghostscript command line executable on MS Windows is gswin32c so use this instead of the plain ' gs ' in the quickstart examples. When passing options to ghostcript through a batch file wrapper such as ps2pdf.

For example:. There is also an older version for MS Windows called just gswin32 that provides its own window for the interactive postscript prompt. The executable gswin32c is usually the better option since it uses the native command prompt window.

For printer devices, the default output is the default printer. This can be modified as follows. Invoking Ghostscript from the command prompt in Windows is supported by the Windows executable described above.

In addition to the device parameters recognized by all devices , Ghostscript's X driver provides parameters to adjust its performance. Users will rarely need to modify these. Note that these are parameters to be set with the -d switch in the command line e. Xdefaults file. Because of bugs in the SCO Unix kernel, Ghostscript will not work if you select direct screen output and also allow it to write messages on the console.

If you are using direct screen output, redirect Ghostscript's terminal output to a file. Because Ghostscript must initialize the PostScript environment before executing the commands specified by this option it should be specified after other setup options. Specifically this option 'bind's all operations and sets the systemdict to readonly. Note that by "library files" here we mean all the files identified using the search rule under " How Ghostscript finds files " above: Ghostscript's own initialization files, fonts, and files named on the command line.

However, device parameters set this way PageSize , Margins , etc. As noted above, -d and -s define initial values for PostScript names. Some of these names are parameters that control the interpreter or the graphics engine. Otherwise, images are rendered using the nearest neighbour scaling Bresenham's line algorithm through the image, plotting the closest texture coord at each pixel.

When downscaling this results in some source pixels not appearing at all in the destination. When upscaling, each source pixels will cover at least one destination pixel.

This allows for a performance vs. Every source pixel will contribute partially to the destination pixels. Computationally, image interpolation is much more demanding than without interpolation lots of floating point muliplies and adds for every output pixel vs simple integer additions, subtractions, and shifts.

In all but special cases image interpolation uses a Mitchell filter function to scale the contributions for each output pixel. When upscaling, every output pixel ends up being the weighted sum of 16 input pixels, When downscaling more source pixels will contribute to the interpolated pixels. Every source pixel has some effect on the output pixels. Note that because of the way antialiasing blends the edges of shapes into the background when they are drawn some files that rely on joining separate filled polygons together to cover an area may not render as expected with GraphicsAlphaBits at 2 or 4.

Further note; because this feature relies upon rendering the input it is incompatible, and will generate an error on attempted use, with any of the vector output devices. PCL andPostScript cannot be handled in ths way, and so all the pages must be interpreted. Adobe specifies GenericResourceDir to be an absolute path to a single resource directory. Ghostscript instead maintains multiple resource directories and uses an extended method for finding resources, which is explained in "Finding PostScript Level 2 resources".

Due to the extended search method, Ghostscript uses GenericResourceDir only as a default directory for resources being not installed. Therefore GenericResourceDir may be considered as a place where new resources to be installed. The default implementation of the function ResourceFileName uses GenericResourceDir when 1 it is an absolute path, or 2 the resource file is absent.

Print pdf ghostscript

The extended search method does not call ResourceFileName. Pages can be printed in reverse or normal order, or selected pages, including all even or all odd, and multiple collated copies can be produced. Since pages are saved until the flush command, pages can be printed multiple times, in any order.

Because its possible as of PDF 2. Instead this option takes a string, which is first compared against the OutputConditionIdentifier in each OutputIntent in the array. If the OutputConditionIdentifier is not a standard identifier then it should be Custom and the UseOutputIntent string will be matched against the value of the Info key instead.

If the current directory is the first path a test is made for the iccprofiles directory. Next, the remaining paths with the string Resource in it are tested. The prefix up to the path separator character preceding the string Resource, concatenated with the string iccprofiles is used and if this exists, then this path will be used for ICCProfilesDir. This also requires that the input be from stdin, otherwise an error will result Error: Example usage is: This mode should be used with caution, and.

This mode also sets the. Ghostscript attempts to find an optimum balance between speed and memory consumption, but there are some cases in which you may get a very large speedup by telling Ghostscript to use more memory.

Please note that this discussion relates to devices which produce a bitmap format as the output. These parameters have no effect on the vector devices, such as pdfwrite. All devices may use a display list "clist" and use banding when rendering PDF 1. This prevents allocation of excessively large amounts of memory for the transparency buffer stack. The number of threads should generally be set to the number of available processor cores for best throughput.

This can also be useful in processing large documents when using a high-level vector output device like pdfwrite that maintains significant internal state. In fact, the.

Creating a Ghostscript PDF Printer

For pattern tiles that are very large, Ghostscript uses an internal display list memory based clist , but this can slow things down. The current default threshold is 8Mb -- pattern tiles larger than this will be cached as clist rather than bitmap tiles. There are several debugging switches that are detected by the interpreter. These switches are available whether or not Ghostscript was built with the DEBUG macro defined to the compiler refer to building a debugging configuration.

Previous to 8. Now there are several debugging flags to allow more selective debugging information to be printed containing only what is needed to investigate particular areas.

You might also like: PDF PRINTER 64 BIT

The -Z and -T switches apply only if the interpreter was built for a debugging configuration. In the table below, the first column is a debugging switch, the second is an equivalent switch if any and the third is its usage.

The following switch affects what is printed, but does not select specific items for printing:. In addition, calling ghostscript with --debug will list all the currently defined non visual trace debugging flags, both in their short form as listed above for use with -Z and in a long form, which can be used as in: All the short form flags for -Z have an equivalent long form. Future flags may be added with a long form only due to all the short form flags being used already.

Visual Trace allows to view internal Ghostscript data in a graphical form while execution of C code. Special instructions to be inserted into C code for generating the output. Client application rasterizes it into a window.

Currently the rasterization is implemented for Windows only, in clients gswin There are two important incompletenesses of the implementation:.

Ghostscript silent printing

The graphical output uses a hardcoded scale. An advanced client would provide a scale option via user interface. Breaks are not implemented in the client. If you need a step-by-step view, you should use an interactive C debugger to delay execution at breakpoints. The table here lists them by name and size. A guide to international paper sizes can be found at. Initially the B paper sizes are the ISO sizes, e. In this environment, the relevant section of the resource file should look like this:.

Printing PDF using Ghostscript in C# - CodeProject

FreeType is now the default font renderer for Ghostscript. Please ignore issues about UFST if you haven't got it.

Important note: Third-party font renderers may be incompatible with devices that can embed fonts in their output such as pdfwrite , because such renderers may store fonts in a form from which Ghostscript cannot get the necessary information for embedding, for example, the Microtype fonts supplied with the UFST. Ghostscript can be configured to disable such renderers when such a device is being used.

As of Ghostscript version 9. With this change, we added a new switch: With version 9. Both bridges may run together. There are 2 ways to handle fonts with a third-party font renderer FAPI. Ghostscript searches the specified file names as explained in How Ghostscript finds files.

Default values for these arguments are equal to argument names. Font files, which are being handled with FAPI, may reside in any directory in your hard disk. Paths to them to be specified in FAPIfontmap and with special command line arguments, explained below. The path may be either absolute or relative.

Relative ones are being resolved from the path, which is specified in FAPIconfig file. It may include records of 2 types: A general record describes a font, which is being rendered with FAPI. They must end with semicolon. Each general record is a pair. The first element of the pair is the font name the name that PostScript documents use to access the font, which may differ from real name of the font which the font file defines. The second element is a dictionary with entries:.

Each record of a group occupy a single line, and contains a number and 1, 2 or 3 names. The number is the font index in the FCO file, the first name is the Postscript font name, the secong is an Encoding resource name, and the third is a decoding resource name.

CID fonts to be listed in another map file. The format is similar to FAPIfontmap , but dictionaries must contain few different entries:. The last ones defines the configuration for handling resident UFST fonts only. Follow instructions in it. If UFST needs it and the command line argument is not specified, Ghostscript prints a warning and searches plugin file in the current directory.

If you want to run UFST with resident UFST fonts only and allow Ghostscript font renderer to handle fons, which may be downloaded or embedded into documents , you should run Ghostscript with these command line arguments: