Quantcast
Channel: Ghostscript.NET
Viewing all 393 articles
Browse latest View live

New Post: How to know given PDF file is color pdf or graypdf

$
0
0
Hi
Thanks for Reply.When I execute these code then given error. PPP() is not fond from assembly .I am using Ghostscript.NET.v.1.1.2.dll. Again as your instruction I inserted code'proc.StartProcessing(switches.ToArray(), null);' instead of 'proc.StartProcessing(switches.ToArray(), new PPP());'.
But It not work properly. I attached error snapsot

Thanks in advanced




New Post: How to know given PDF file is color pdf or graypdf

$
0
0
Change line:

proc.StartProcessing(switches.ToArray(), new PPP());

to

proc.StartProcessing(switches.ToArray(), null);

Cheers,
Josip

Created Unassigned: Assembly generation failed -- Referenced assembly 'Ghostscript.NET' does not have a strong name [2123]

$
0
0
When I get Ghostscript.NET from NuGet I get that error in VS 2013, .net 4.5 project. Could You sign a strong name for this assembly ? Please help, I need use it ASAP

New Post: GhostScript dll

$
0
0
Many thanks for your help. That works nicely.

New Post: How to know given PDF file is color pdf or graypdf

$
0
0
What happens when you execute this line:
proc.StartProcessing(switches.ToArray(), null);
?

New Post: System.NullReferenceException when loading GhostscriptRasterizer from memory on Server 2012 R2

$
0
0
Hi Josip,

I've had a go at debugging the code, and you were right - there was an issue with DynamicNativeLibrary, but it looks like the issue isn't Server 2012 R2, but rather the memory size difference.

The code on the server was failing at this point:
GhostsciptInterpreter.Initialize()
int rc_ins = _gs.gsapi_new_instance(out _gs_instance, IntPtr.Zero);
_gs.gsapi_new_instance was set to null, so I had a look at where it gets initialized:
GhostscriptLibrary.Initialize()
this.gsapi_new_instance = _library.GetDelegateForFunction("gsapi_new_instance", typeof(gsapi_new_instance)) as gsapi_new_instance;
All the functions in the library were returning as null. Looking at GetDelegateForFunction in DynamicNativeLibrary, it uses the following method to set the addresses:
DynamicNativeLibrary.GetProcAddress(procName)
            ...
            // search function name in list of exported names
            nameRef = (uint*)(codeBase + exports->AddressOfNames);
            ordinal = (ushort*)(codeBase + exports->AddressOfNameOrdinals);

            for (i = 0; i < exports->NumberOfNames; i++, nameRef++, ordinal++)
            {
                IntPtr procNameHandle = (IntPtr)((byte*)((uint)codeBase + *nameRef));
                string testProcName = Marshal.PtrToStringAnsi(procNameHandle);

                if (testProcName == procName)
                {
                    idx = *ordinal;
                    break;
                }
            }
nameRef / ordinal were pointing to the right place, but the procNameHandle was always pointing to an inaccessible memory block. (uint)codeBase was not evaluating correctly, so I changed it to
IntPtr procNameHandle = (IntPtr)((byte*)((UInt64)codeBase + *nameRef));
And it works! So it looks like the codeBase pointer was being truncated.

If you think this is the right solution, would you be able to incorporate this into the next release please?

Many thanks,
Antony

Source code checked in, #29205

$
0
0
Added GhostscriptPdfInfo.GetInkCoverage function which has ability to return ink coverage for the CMYK inks, separately for each single page (for RGB colors, it does a silent conversion to CMYK color space internally). This function can be used to check if the pdf is grayscale or color. Fixed problem with opening MemoryStream EPS files which contains "EPS Preview Header" (reported by "Chanan Eli"). Fixed problem with empty %%BoundingBox value when handling PostScript files. (thanks to by "Shane_S"). Fixed problem with rasterizing EPS files created with Adobe Illustrator. (reported by "Chanan Eli"). Fixed problem with retrieving exported function handle in DynamicNativeLibrary noticed on the Server 2012 R2 with large amount of memory (thanks to "antonyoni"). Assembly is now signed with a strong name key (requested by "netmajor")

Source code checked in, #29207


Released: Ghostscript.NET v.1.1.3. (Feb 05, 2014)

$
0
0
v.1.1.3.
  • added GhostscriptPdfInfo.GetInkCoverage function which has ability to return ink coverage for the CMYK inks, separately for each single page (for RGB colors, it does a silent conversion to CMYK color space internally). This function can be used to check if the pdf is grayscale or color.
  • fixed problem with opening MemoryStream EPS files which contains "EPS Preview Header" (reported by "Chanan Eli")
  • fixed problem with empty %%BoundingBox value when handling PostScript files (thanks to by "Shane_S")
  • fixed problem with rasterizing EPS files created with Adobe Illustrator (reported by "Chanan Eli")
  • fixed problem with retrieving exported function handle in DynamicNativeLibrary noticed on the Server 2012 R2 with large amount of memory (thanks to "antonyoni")
  • assembly is now signed with a strong name key (requested by "netmajor")

v.1.1.2.
  • fixed GhostscriptPipedOutput.Data property get accesor in order to prevent a race condition. (thanks to "Marc Klenotic").
  • added GhostscriptPipedOutput class as part of the Ghostscript.NET library.
  • fixed GhostscriptException error code text message resolving.
  • implemented better methods parameters checking and exception handling.
  • changed ImageMemoryHelper class from public to internal.
  • implemented opening files represented as MemoryStream from GhostscriptRasterizer and GhostscriptViewer. (that was some users request although there is no point of passing PDF as MemoryStream (or byte array) as it will anyway end up on the disk before it will be interpreted as PDF language, unlike the PostScript language, inherently requires random access to the file).

v.1.1.1.
  • fixed problem in GhostscriptRasterizer and GhostscriptViewer when MediaBox contains negative llx or lly values. (problem reported by "Prasenjit Das").
  • added GhostscriptPngDevice, a friendly output device class with all png devices related switches. (GhostscriptPngDevice supports: png16m, pngalpha, pnggray, png256, png16, pngmono, pngmonod).
  • added GhostscriptJpegDevice, a friendly output device class with all jpeg devices related switches. (GhostscriptJpegDevice supports: jpeg, jpeggray).
  • extended GhostscriptProcessor.StartProcessing method to support GhostscriptDevice base class as StartProcessing parameter.
  • for each constructor / method that requires GhostscriptVersionInfo parameter, now there is one more constructor / method available with a same functionality but without a need to pass GhostscriptVersionInfo parameter. This new constructors and methods automatically retrieves and use last installed Ghostscript version.
  • added new samples to the Ghostscript.NET.Samples project (AddWatermarkSample, ProcessorSample, DeviceUsageSample).

v.1.1.0.
  • added GhostscriptViewer state handling (SaveState, RestoreState)
  • GhostscriptRasterizer constructor is extended in order to support usage of the existing GhostscriptViewer instance.
  • fixed problem while using a 32-bit assembly with 32-bit version of Ghostscript on 64-bit Windows: It couldn't find a registry key of installed Ghostscript. Reported and fixed by "r0land".

v.1.0.9.
  • implemented EPS (Encapsulated PostScript) support for the GhostscriptViewer.
  • added GhostscriptRasterizer class which provides ability to easily export PDF pages, PostScript pages and EPS files to the System.Drawing.Image object in the memory. For each page different x and y dpi settings can be set.
  • fixed gsapi_stdin callback and it's value passing to the ghostscript library.
  • added ProgressiveUpdate property to the GhostscriptViewer class so progressive update can be controlled outside the library.

v.1.0.8.
  • implemented StopProcessing method in the GhostscriptProcessor class which allows us to terminate gsapiinitwith_args call in the multithread environment.
  • fixed GhostscriptViewer ZoomIn and ZoomOut problem on the systems where windows region and language settings has number decimal symbol set to comma.
  • added page navigation and zoom checker properties to the GhostscriptViewer class.
  • fixed problem in GhostscriptViewer class when trying to view PostScript files without DSC header.
  • GhostscriptProcessor.Process method name changed to StartProcessing.
Also check out Ghostscript Studio (http://ghostscriptstudio.codeplex.com/)

v.1.0.7.
  • implemented multi-page PostScript support for the GhostscriptViewer
  • included Microsoft.WinAny.Helper code files in order to have a single dll for the deployment
  • added Processing event to the GhostscriptProcessor class (with CurrentPage and TotalPages info)
  • added zoom-in and zoom-out functionality
  • fixed ImageMemoryHelper.Set24bppRgbImageColor function when stride size is not multiple of 3 bytes
  • fixed displayed page size
v.1.0.6.
  • implemented progressive display update while ghostscript is drawing / rasterizing, now a custom update interval can be set in GhostscriptViewer class.
  • fixed problem when using 64-bit ghostscript library where raster (stride) line size is not equal to 32-bit ghostscript library raster line size.
  • changed GhostscriptViewer class event logic.
  • changed Ghostscript.NET.Viewer application in order to show progressive update.
  • modified Ghostscript.NET.DisplayTest, now it uses GhostscriptViewer class with ability to interpret postscript and display standard input output messages.

Created Release: Ghostscript.NET v.1.1.3. (Feb 05, 2014)

$
0
0
v.1.1.3.
  • added GhostscriptPdfInfo.GetInkCoverage function which has ability to return ink coverage for the CMYK inks, separately for each single page (for RGB colors, it does a silent conversion to CMYK color space internally). This function can be used to check if the pdf is grayscale or color.
  • fixed problem with opening MemoryStream EPS files which contains "EPS Preview Header" (reported by "Chanan Eli")
  • fixed problem with empty %%BoundingBox value when handling PostScript files (thanks to by "Shane_S")
  • fixed problem with rasterizing EPS files created with Adobe Illustrator (reported by "Chanan Eli")
  • fixed problem with retrieving exported function handle in DynamicNativeLibrary noticed on the Server 2012 R2 with large amount of memory (thanks to "antonyoni")
  • assembly is now signed with a strong name key (requested by "netmajor")

v.1.1.2.
  • fixed GhostscriptPipedOutput.Data property get accesor in order to prevent a race condition. (thanks to "Marc Klenotic").
  • added GhostscriptPipedOutput class as part of the Ghostscript.NET library.
  • fixed GhostscriptException error code text message resolving.
  • implemented better methods parameters checking and exception handling.
  • changed ImageMemoryHelper class from public to internal.
  • implemented opening files represented as MemoryStream from GhostscriptRasterizer and GhostscriptViewer. (that was some users request although there is no point of passing PDF as MemoryStream (or byte array) as it will anyway end up on the disk before it will be interpreted as PDF language, unlike the PostScript language, inherently requires random access to the file).

v.1.1.1.
  • fixed problem in GhostscriptRasterizer and GhostscriptViewer when MediaBox contains negative llx or lly values. (problem reported by "Prasenjit Das").
  • added GhostscriptPngDevice, a friendly output device class with all png devices related switches. (GhostscriptPngDevice supports: png16m, pngalpha, pnggray, png256, png16, pngmono, pngmonod).
  • added GhostscriptJpegDevice, a friendly output device class with all jpeg devices related switches. (GhostscriptJpegDevice supports: jpeg, jpeggray).
  • extended GhostscriptProcessor.StartProcessing method to support GhostscriptDevice base class as StartProcessing parameter.
  • for each constructor / method that requires GhostscriptVersionInfo parameter, now there is one more constructor / method available with a same functionality but without a need to pass GhostscriptVersionInfo parameter. This new constructors and methods automatically retrieves and use last installed Ghostscript version.
  • added new samples to the Ghostscript.NET.Samples project (AddWatermarkSample, ProcessorSample, DeviceUsageSample).

v.1.1.0.
  • added GhostscriptViewer state handling (SaveState, RestoreState)
  • GhostscriptRasterizer constructor is extended in order to support usage of the existing GhostscriptViewer instance.
  • fixed problem while using a 32-bit assembly with 32-bit version of Ghostscript on 64-bit Windows: It couldn't find a registry key of installed Ghostscript. Reported and fixed by "r0land".

v.1.0.9.
  • implemented EPS (Encapsulated PostScript) support for the GhostscriptViewer.
  • added GhostscriptRasterizer class which provides ability to easily export PDF pages, PostScript pages and EPS files to the System.Drawing.Image object in the memory. For each page different x and y dpi settings can be set.
  • fixed gsapi_stdin callback and it's value passing to the ghostscript library.
  • added ProgressiveUpdate property to the GhostscriptViewer class so progressive update can be controlled outside the library.

v.1.0.8.
  • implemented StopProcessing method in the GhostscriptProcessor class which allows us to terminate gsapiinitwith_args call in the multithread environment.
  • fixed GhostscriptViewer ZoomIn and ZoomOut problem on the systems where windows region and language settings has number decimal symbol set to comma.
  • added page navigation and zoom checker properties to the GhostscriptViewer class.
  • fixed problem in GhostscriptViewer class when trying to view PostScript files without DSC header.
  • GhostscriptProcessor.Process method name changed to StartProcessing.
Also check out Ghostscript Studio (http://ghostscriptstudio.codeplex.com/)

v.1.0.7.
  • implemented multi-page PostScript support for the GhostscriptViewer
  • included Microsoft.WinAny.Helper code files in order to have a single dll for the deployment
  • added Processing event to the GhostscriptProcessor class (with CurrentPage and TotalPages info)
  • added zoom-in and zoom-out functionality
  • fixed ImageMemoryHelper.Set24bppRgbImageColor function when stride size is not multiple of 3 bytes
  • fixed displayed page size
v.1.0.6.
  • implemented progressive display update while ghostscript is drawing / rasterizing, now a custom update interval can be set in GhostscriptViewer class.
  • fixed problem when using 64-bit ghostscript library where raster (stride) line size is not equal to 32-bit ghostscript library raster line size.
  • changed GhostscriptViewer class event logic.
  • changed Ghostscript.NET.Viewer application in order to show progressive update.
  • modified Ghostscript.NET.DisplayTest, now it uses GhostscriptViewer class with ability to interpret postscript and display standard input output messages.

Closed Unassigned: Assembly generation failed -- Referenced assembly 'Ghostscript.NET' does not have a strong name [2123]

$
0
0
When I get Ghostscript.NET from NuGet I get that error in VS 2013, .net 4.5 project. Could You sign a strong name for this assembly ? Please help, I need use it ASAP
Comments: Fixed in Ghostscript.NET v.1.1.3. (which is released today)

New Post: System.NullReferenceException when loading GhostscriptRasterizer from memory on Server 2012 R2

$
0
0
Hi Antony,

Thank you for your time on fixing this problem.

I included this fix in today's Ghostscript.NET v.1.1.3. release.

Cheers,
Josip

New Post: How to know given PDF file is color pdf or graypdf

Updated Wiki: Home

$
0
0

Ghostscript.NET (written in C#) is the most completedmanaged wrapper library around the Ghostscript library (32-bit & 64-bit), an interpreter for the PostScript language, PDF, related software and documentation.

All other .NET Ghostscript wrappers that you can find on the internet this days does not allow you to render PDF page directly to the screen without exporting the pages to the disk first. This wrapper does not require exporting to the disk, it can render PDF pages to the screen directly from the Ghostscript interpreter.

Chat: https://jabbr.net/#/rooms/ghostscriptnet

NuGet: PM> Install-Package Ghostscript.NET

Used in Ghostscript Studio (Ghostscript IDE)

                                                       

Features of the Ghostscript.NET are:

  • It contains GhostscriptViewer class which allows you to easily render and navigate through PDF or PostScript files on the screen via code.  It can handle multi-page PostScript files.
  • GhostscriptViewer class contains progressive display update implementation. While Ghostscript is drawing / rasterizing you can see tiles drawing on the screen. Custom update interval can be set.
  • GhostscriptViewer class has Zoom-in and Zoom-out functionality.
  • It contains GhostscriptRasterizer class which provides ability to easily exportPDF pages, PostScript pages and EPS files to the System.Drawing.Image object in the  memory.
  • It allows you to run multiple instances of the Ghostscript library (dll) simultaneously within a single process (Ghostscript API does not support this out-of-the-box). This is achieved by using Microsoft.WinAny.Helper library and it's DynamicNativeLibrary class which allows you to load a native library from the memory instead from a disk. By doing this (loading from the memory), all Ghostscript instances are running in their own context.
  • It contains GhostscriptProcessor class which allows you to call Ghostscript library (dll) with a custom specified arguments / switches.
  • All Ghostscript functions which provides ability to rasterize / render postscript or pdf directly to the screen without a need to save it to the disk first are implemented.
  • It's completely compatible and tested with 32-bit and 64-bit Ghostscript library.

Plans:

  • Extending this library to be more "developer" friendly.

Sample applications screenshots below (built on the top of the Ghostscript.NET library):

Ghostscript.NET.Viewer: (supports viewing of PDF and multi-page PS files)

  Ghostscript.NET.Viewer 

Example of direct postscript rasterizing via Ghostscript.NET.

Cheers,
Josip Habjan
http://habjan.blogspot.com

 

Website counter

New Post: How to know given PDF file is color pdf or graypdf

$
0
0
Hi
Thanks it work fine but I am not get font color of pdf file.attached the pdf below.
Is there any procedure to get font color?

Thanks in advanced
:)




New Post: How to know given PDF file is color pdf or graypdf

Source code checked in, #29226

$
0
0
Fixing problem with applying GraphicsAlphaBits and TextAlphaBits which improves antialiasing in GhostscriptViewer and GhostscriptRasterizer. Fixed problem with output through main stderr callback handler.

Source code checked in, #29230

Source code checked in, #29289

$
0
0
Fixed problem with applying GraphicsAlphaBits and TextAlphaBits which improved antialiasing in GhostscriptViewer and GhostscriptRasterizer. Fixed problem with output through main stderr callback handler. Added support for MemoryStream in the GhostscriptPdfInfo.GetInkCoverage method. Added GraphicsAlphaBits and TextAlphaBits properties in GhostscriptViewer and GhostscriptRasterizer so antialiasing can now be changed from outside.

Released: Ghostscript.NET v.1.1.4. (Feb 14, 2014)

$
0
0
v.1.1.4.
  • fixed problem with applying GraphicsAlphaBits and TextAlphaBits which improved antialiasing in GhostscriptViewer and GhostscriptRasterizer.
  • fixed problem with output through main stderr callback handler.
  • added support for MemoryStream in the GhostscriptPdfInfo.GetInkCoverage method.
  • added GraphicsAlphaBits and TextAlphaBits properties in GhostscriptViewer and GhostscriptRasterizer so antialiasing can now be changed from the outside...

v.1.1.3.
  • added GhostscriptPdfInfo.GetInkCoverage function which has ability to return ink coverage for the CMYK inks, separately for each single page (for RGB colors, it does a silent conversion to CMYK color space internally). This function can be used to check if the pdf is grayscale or color.
  • fixed problem with opening MemoryStream EPS files which contains "EPS Preview Header" (reported by "Chanan Eli")
  • fixed problem with empty %%BoundingBox value when handling PostScript files (thanks to by "Shane_S")
  • fixed problem with rasterizing EPS files created with Adobe Illustrator (reported by "Chanan Eli")
  • fixed problem with retrieving exported function handle in DynamicNativeLibrary noticed on the Server 2012 R2 with large amount of memory (thanks to "antonyoni")
  • assembly is now signed with a strong name key (requested by "netmajor")

v.1.1.2.
  • fixed GhostscriptPipedOutput.Data property get accesor in order to prevent a race condition. (thanks to "Marc Klenotic").
  • added GhostscriptPipedOutput class as part of the Ghostscript.NET library.
  • fixed GhostscriptException error code text message resolving.
  • implemented better methods parameters checking and exception handling.
  • changed ImageMemoryHelper class from public to internal.
  • implemented opening files represented as MemoryStream from GhostscriptRasterizer and GhostscriptViewer. (that was some users request although there is no point of passing PDF as MemoryStream (or byte array) as it will anyway end up on the disk before it will be interpreted as PDF language, unlike the PostScript language, inherently requires random access to the file).

v.1.1.1.
  • fixed problem in GhostscriptRasterizer and GhostscriptViewer when MediaBox contains negative llx or lly values. (problem reported by "Prasenjit Das").
  • added GhostscriptPngDevice, a friendly output device class with all png devices related switches. (GhostscriptPngDevice supports: png16m, pngalpha, pnggray, png256, png16, pngmono, pngmonod).
  • added GhostscriptJpegDevice, a friendly output device class with all jpeg devices related switches. (GhostscriptJpegDevice supports: jpeg, jpeggray).
  • extended GhostscriptProcessor.StartProcessing method to support GhostscriptDevice base class as StartProcessing parameter.
  • for each constructor / method that requires GhostscriptVersionInfo parameter, now there is one more constructor / method available with a same functionality but without a need to pass GhostscriptVersionInfo parameter. This new constructors and methods automatically retrieves and use last installed Ghostscript version.
  • added new samples to the Ghostscript.NET.Samples project (AddWatermarkSample, ProcessorSample, DeviceUsageSample).

v.1.1.0.
  • added GhostscriptViewer state handling (SaveState, RestoreState)
  • GhostscriptRasterizer constructor is extended in order to support usage of the existing GhostscriptViewer instance.
  • fixed problem while using a 32-bit assembly with 32-bit version of Ghostscript on 64-bit Windows: It couldn't find a registry key of installed Ghostscript. Reported and fixed by "r0land".

v.1.0.9.
  • implemented EPS (Encapsulated PostScript) support for the GhostscriptViewer.
  • added GhostscriptRasterizer class which provides ability to easily export PDF pages, PostScript pages and EPS files to the System.Drawing.Image object in the memory. For each page different x and y dpi settings can be set.
  • fixed gsapi_stdin callback and it's value passing to the ghostscript library.
  • added ProgressiveUpdate property to the GhostscriptViewer class so progressive update can be controlled outside the library.

v.1.0.8.
  • implemented StopProcessing method in the GhostscriptProcessor class which allows us to terminate gsapiinitwith_args call in the multithread environment.
  • fixed GhostscriptViewer ZoomIn and ZoomOut problem on the systems where windows region and language settings has number decimal symbol set to comma.
  • added page navigation and zoom checker properties to the GhostscriptViewer class.
  • fixed problem in GhostscriptViewer class when trying to view PostScript files without DSC header.
  • GhostscriptProcessor.Process method name changed to StartProcessing.
Also check out Ghostscript Studio (http://ghostscriptstudio.codeplex.com/)

v.1.0.7.
  • implemented multi-page PostScript support for the GhostscriptViewer
  • included Microsoft.WinAny.Helper code files in order to have a single dll for the deployment
  • added Processing event to the GhostscriptProcessor class (with CurrentPage and TotalPages info)
  • added zoom-in and zoom-out functionality
  • fixed ImageMemoryHelper.Set24bppRgbImageColor function when stride size is not multiple of 3 bytes
  • fixed displayed page size
v.1.0.6.
  • implemented progressive display update while ghostscript is drawing / rasterizing, now a custom update interval can be set in GhostscriptViewer class.
  • fixed problem when using 64-bit ghostscript library where raster (stride) line size is not equal to 32-bit ghostscript library raster line size.
  • changed GhostscriptViewer class event logic.
  • changed Ghostscript.NET.Viewer application in order to show progressive update.
  • modified Ghostscript.NET.DisplayTest, now it uses GhostscriptViewer class with ability to interpret postscript and display standard input output messages.
Viewing all 393 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>