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

New Post: Send output to variable in place of file

$
0
0
That does indeed work. Thank you VERY kindly for this.

I do have a number of pdf files that errors out if I don’t restrict the page range 1 to 1.

I will see if I can follow up if they are just bad pdf files (and thus really a GS issue, not your code)

And for the readers, here is the vb.net version.
        Dim strPDF As String = "c:\MyFolder\b.pdf"

        Dim gP As New Ghostscript.NET.Processor.GhostscriptProcessor()
        Dim gpH As New Ghostscript.NET.GhostscriptPipedOutput
        Dim outputPieHande As String = "%handle%" + CInt(gpH.ClientHandle).ToString("X2")

        Dim Myargs As New List(Of String)
        With Myargs
            .Add("-empty")
            .Add("-dSAFER")
            .Add("-dBATCH")
            .Add("-dNOPAUSE")
            .Add("-dNOPROMPT")
            .Add("-dFirstPage=1")
            .Add("-dLastPage=1")
            .Add("-sDEVICE=txtwrite")
            .Add("-o" & outputPieHande)
            .Add("-q")
            .Add("-f")
            .Add(strPDF)
        End With

        gP.StartProcessing(Myargs.ToArray, Nothing)

        Dim raw As Byte() = gpH.Data
        Dim strOut = System.Text.Encoding.UTF8.GetString(raw)
        gpH.Dispose()

        MsgBox(strOut)
Once again, a real kind thumbs up for your short example, as I am sure many will benefit from this.

Regards,
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

Viewing all articles
Browse latest Browse all 393

Trending Articles



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