Advertisement
Guest User

Untitled

a guest
Apr 25th, 2014
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1. private void convert(string input, string output)
  2. {
  3.  
  4. output = @"C:\show%03d.png";
  5. Utils utils = new Utils();
  6. string path = System.IO.Path.Combine(utils.getStartupPath(), "gsdll32.dll");
  7.  
  8. // create a new GhostscriptVersionInstance with a custom dll path
  9. // if you are running on 64 bit machine, make sure you use gsdll64.dll
  10. GhostscriptVersionInfo gvi = new GhostscriptVersionInfo(
  11. new Version(),
  12. @"" + path,
  13. string.Empty,
  14. GhostscriptLicense.GPL);
  15.  
  16. GhostscriptPngDevice dev = new GhostscriptPngDevice(GhostscriptPngDeviceType.Png16m);
  17. dev.GraphicsAlphaBits = GhostscriptImageDeviceAlphaBits.V_4;
  18. dev.TextAlphaBits = GhostscriptImageDeviceAlphaBits.V_4;
  19. dev.ResolutionXY = new GhostscriptImageDeviceResolution(96, 96);
  20. dev.InputFiles.Add(@input);
  21. //dev.InputFiles.Add(@input);
  22. dev.Pdf.FirstPage = 1;
  23. dev.Pdf.LastPage = int.MaxValue;
  24.  
  25.  
  26. dev.CustomSwitches.Add("-g1280x752>");
  27. dev.CustomSwitches.Add("-dFitPage");
  28.  
  29. dev.OutputPath = @output;
  30. //dev.OutputPath = @output;
  31.  
  32. // make sure you pass GhostscriptVersionInfo to the device
  33. ERROR >>>>>>dev.Process(gvi, true, null);
  34.  
  35. }
  36.  
  37.  
  38.  
  39. System.AccessViolationException was unhandled
  40. HResult=-2147467261
  41. Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  42. Source=Ghostscript.NET
  43. StackTrace:
  44. at Microsoft.WinAny.Interop.DynamicNativeLibrary.CallDllEntryPoint(MEMORY_MODULE* memory_module, UInt32 fdwReason)
  45. at Microsoft.WinAny.Interop.DynamicNativeLibrary.MemoryLoadLibrary(Byte[] data)
  46. at Microsoft.WinAny.Interop.DynamicNativeLibrary..ctor(Byte[] buffer)
  47. at Ghostscript.NET.GhostscriptLibrary..ctor(GhostscriptVersionInfo version, Boolean fromMemory)
  48. at Ghostscript.NET.Processor.GhostscriptProcessor..ctor(GhostscriptVersionInfo version, Boolean fromMemory)
  49. at Ghostscript.NET.GhostscriptDevice.Process(GhostscriptVersionInfo ghostscriptVersion, Boolean fromMemory, GhostscriptStdIO stdIO_callback)
  50. at CuuOnline1.PDFtoPNG.convert(String input, String output) in c:\Users\Zilvinas\Documents\Visual Studio 2013\Projects\PdfToPngConverter\PdfToPngConverter\PDFtoPNG.cs:line 51
  51. at CuuOnline1.PDFtoPNG.convertPDF(String input, String output) in c:\Users\Zilvinas\Documents\Visual Studio 2013\Projects\PdfToPngConverter\PdfToPngConverter\PDFtoPNG.cs:line 15
  52. at CuuOnline1.Program.Main(String[] args) in c:\Users\Zilvinas\Documents\Visual Studio 2013\Projects\PdfToPngConverter\PdfToPngConverter\Program.cs:line 24
  53. at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
  54. at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
  55. at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
  56. at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
  57. at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
  58. at System.Threading.ThreadHelper.ThreadStart()
  59. InnerException:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement