I'm using visual studio 2015 with VB language Web application, my issue in brief I used Ghostscript to extract pdf first page to png its work fine but if pdf file name contain space its does not extract png and no error show up or if written on other language the error " Page number is not in pages number range!". I appreciate any help.
test.pdf ---> work fine
new york.pdf --->nothing happen no error show up
pdf file name not written in English --->error "Page number is not in pages number range!"
code is
Imports Ghostscript.NET
Imports Ghostscript.NET.Rasterizer
Imports System.IO
Imports System.Drawing.Imaging
Imports System.Drawing
Partial Class Default6
Inherits System.Web.UI.Page
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim inputPdfPath As String = "d:\test\test.pdf"
Dim outputPath As String = "d:\test\"
Using Rasterizer = New GhostscriptRasterizer
Rasterizer.CustomSwitches.Add("-dUseTrimBox")
Rasterizer.CustomSwitches.Add("-g683x960")
Rasterizer.CustomSwitches.Add("-f")
Rasterizer.Open(inputPdfPath)
Dim pageFilePath As String = Path.Combine(outputPath, "Page1" + ".jpg")
Dim img As Image = Rasterizer.GetPage(100, 1)
img.Save(pageFilePath, ImageFormat.Png)
Console.WriteLine(pageFilePath)
End Using
End Sub
End Class