Print Page | Close Window

Need to Convert PS to PDF

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=1695
Printed Date: 27 Jan 26 at 12:44AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Need to Convert PS to PDF
Posted By: stevengupta
Subject: Need to Convert PS to PDF
Date Posted: 27 Dec 10 at 6:10PM
I am trying to convert out a postscript file to a PDF file.

I am using the code below.

When it comes to the save portion I end up with a blank PDF file.

Any ideas?

    Public Sub ConvertPS(ByVal PsFile As String)

        Dim OutputPDF As String

        Dim psReader As String

        OutputPDF = Replace(UCase(PsFile), ".PS", ".PDF")

        If File.Exists(OutputPDF) Then
            Kill(OutputPDF)
        End If

        Dim objSR As New StreamReader(PsFile)
        psReader = objSR.ReadToEnd
        objSR.Close()

        Dim PDFLibrary As QuickPDFAX0723.PDFLibrary
        PDFLibrary = CreateObject("QuickPDFAX0723.PDFLibrary")
        If PDFLibrary.UnlockKey("YOUR KEY HERE!") = 1 Then

            Dim psO = PDFLibrary.NewPostScriptXObject(psReader)
            Dim i = PDFLibrary.DrawPostScriptXObject(psO)
            PDFLibrary.SaveToFile(OutputPDF)
            PDFLibrary.RemoveDocument(PDFLibrary.SelectedDocument)

        End If

        PDFLibrary = Nothing


    End Sub



Replies:
Posted By: BEvans
Date Posted: 30 Dec 10 at 5:56PM
Embedding raw postscript in a PDF isn't the same as converting a PS file to a PDF. Some PDF viewers won't even show it. In general you print such files to a PDF virtual printer of some kind or use Acrobat Distiller / GhostScript or something equivalent on them directly.

Some links that might be useful:
http://www.planetpdf.com/enterprise/article.asp?ContentID=converting_a_postscript_file_t&gid=6738 - Using Acrobat Distiller to convert PS to PDF
http://www.inkguides.com/merging-extracting-and-converting-postscript-files.asp#convert-postscript-to-and-from-documents-and-files - Tools to convert to/from PS


Posted By: stevengupta
Date Posted: 01 Jan 11 at 7:23PM
Thanks for the reply.
I think you are saying that quick pdf will not convert a ps file to a PDF file.

I was previously using acrobat distiller com object, but after moving from 8.0 to acrobat 9.0 the distiller com object does not work correctly unless the user running the command is actually logged into the terminal server. Under 8.0 it didn't require that.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk