Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void convert(string input, string output)
- {
- output = @"C:\show%03d.png";
- Utils utils = new Utils();
- string path = System.IO.Path.Combine(utils.getStartupPath(), "gsdll32.dll");
- // create a new GhostscriptVersionInstance with a custom dll path
- // if you are running on 64 bit machine, make sure you use gsdll64.dll
- GhostscriptVersionInfo gvi = new GhostscriptVersionInfo(
- new Version(),
- @"" + path,
- string.Empty,
- GhostscriptLicense.GPL);
- GhostscriptPngDevice dev = new GhostscriptPngDevice(GhostscriptPngDeviceType.Png16m);
- dev.GraphicsAlphaBits = GhostscriptImageDeviceAlphaBits.V_4;
- dev.TextAlphaBits = GhostscriptImageDeviceAlphaBits.V_4;
- dev.ResolutionXY = new GhostscriptImageDeviceResolution(96, 96);
- dev.InputFiles.Add(@input);
- //dev.InputFiles.Add(@input);
- dev.Pdf.FirstPage = 1;
- dev.Pdf.LastPage = int.MaxValue;
- dev.CustomSwitches.Add("-g1280x752>");
- dev.CustomSwitches.Add("-dFitPage");
- dev.OutputPath = @output;
- //dev.OutputPath = @output;
- // make sure you pass GhostscriptVersionInfo to the device
- ERROR >>>>>>dev.Process(gvi, true, null);
- }
- System.AccessViolationException was unhandled
- HResult=-2147467261
- Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
- Source=Ghostscript.NET
- StackTrace:
- at Microsoft.WinAny.Interop.DynamicNativeLibrary.CallDllEntryPoint(MEMORY_MODULE* memory_module, UInt32 fdwReason)
- at Microsoft.WinAny.Interop.DynamicNativeLibrary.MemoryLoadLibrary(Byte[] data)
- at Microsoft.WinAny.Interop.DynamicNativeLibrary..ctor(Byte[] buffer)
- at Ghostscript.NET.GhostscriptLibrary..ctor(GhostscriptVersionInfo version, Boolean fromMemory)
- at Ghostscript.NET.Processor.GhostscriptProcessor..ctor(GhostscriptVersionInfo version, Boolean fromMemory)
- at Ghostscript.NET.GhostscriptDevice.Process(GhostscriptVersionInfo ghostscriptVersion, Boolean fromMemory, GhostscriptStdIO stdIO_callback)
- at CuuOnline1.PDFtoPNG.convert(String input, String output) in c:\Users\Zilvinas\Documents\Visual Studio 2013\Projects\PdfToPngConverter\PdfToPngConverter\PDFtoPNG.cs:line 51
- at CuuOnline1.PDFtoPNG.convertPDF(String input, String output) in c:\Users\Zilvinas\Documents\Visual Studio 2013\Projects\PdfToPngConverter\PdfToPngConverter\PDFtoPNG.cs:line 15
- at CuuOnline1.Program.Main(String[] args) in c:\Users\Zilvinas\Documents\Visual Studio 2013\Projects\PdfToPngConverter\PdfToPngConverter\Program.cs:line 24
- at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
- at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
- at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
- at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
- at System.Threading.ThreadHelper.ThreadStart()
- InnerException:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement