wx.PostScript problem

Hi All,

I try to print in a postscript file.
The idea is to create a PostScript file under MSW, put it with SAMBA on Linux machine and a cron will convert it later in a pdf file.
May be it is not possible ?
This next code does not work, no error, but no file "essai.ps" (MS-Vista, Python 2.4.4, wxPython 2.6.3.3 ansi) :

    def OnBtRen(self, evt):
        fp = open('essai.html', 'r')
        texte = fp.read()
        fp.close()
        prd = wx.PrintData()
        prd.SetPrintMode(wx.PRINT_MODE_FILE)
        prd.SetFilename('essai.ps')
        psdc = wx.PostScriptDC(prd)
        prp = wx.html.HtmlPrintout('Essai')
        prp.SetDC(psdc)
        prp.SetHtmlText(texte)
        printer = wx.Printer()
        printer.Print(self, prp, False)

Thank you in advance if somebody has an idea or stop me if it is not possible ...

Friendly.

···

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

I do most of this all the time. The steps I use are a little different.
1. I print to an adobe generic postscript printer (does not matter what I'm
printing) - it creates a postscript file.

2. I process the postscript file with (windows) ghostscript - it creates the
PDF.

3. I then forward it to a smtp server (email) and it is sent as an
attachment.

···

On Wednesday 17 September 2008 07:20:14 am Hugues JEAN-BAPTISTE wrote:

Hi All,

I try to print in a postscript file.
The idea is to create a PostScript file under MSW, put it with SAMBA on
Linux machine and a cron will convert it later in a pdf file.
May be it is not possible ?
This next code does not work, no error, but no file "essai.ps"
(MS-Vista, Python 2.4.4, wxPython 2.6.3.3 ansi) :

    def OnBtRen(self, evt):
        fp = open('essai.html', 'r')
        texte = fp.read()
        fp.close()
        prd = wx.PrintData()
        prd.SetPrintMode(wx.PRINT_MODE_FILE)
        prd.SetFilename('essai.ps')
        psdc = wx.PostScriptDC(prd)
        prp = wx.html.HtmlPrintout('Essai')
        prp.SetDC(psdc)
        prp.SetHtmlText(texte)
        printer = wx.Printer()
        printer.Print(self, prp, False)

Thank you in advance if somebody has an idea or stop me if it is not
possible ...

Friendly.

--
John Fabiani

johnf a écrit :

  

Hi All,

I try to print in a postscript file.
The idea is to create a PostScript file under MSW, put it with SAMBA on
Linux machine and a cron will convert it later in a pdf file.
May be it is not possible ?
This next code does not work, no error, but no file "essai.ps"
(MS-Vista, Python 2.4.4, wxPython 2.6.3.3 ansi) :

    def OnBtRen(self, evt):
        fp = open('essai.html', 'r')
        texte = fp.read()
        fp.close()
        prd = wx.PrintData()
        prd.SetPrintMode(wx.PRINT_MODE_FILE)
        prd.SetFilename('essai.ps')
        psdc = wx.PostScriptDC(prd)
        prp = wx.html.HtmlPrintout('Essai')
        prp.SetDC(psdc)
        prp.SetHtmlText(texte)
        printer = wx.Printer()
        printer.Print(self, prp, False)

Thank you in advance if somebody has an idea or stop me if it is not
possible ...

Friendly.
    
I do most of this all the time. The steps I use are a little different.
1. I print to an adobe generic postscript printer (does not matter what I'm printing) - it creates a postscript file.

2. I process the postscript file with (windows) ghostscript - it creates the PDF.

3. I then forward it to a smtp server (email) and it is sent as an attachment.

Yes, thank you, this works ...

But, the problem is this necessary to install a PostScript driver (On Vista).
So my dream was to use the capability of wxPython to create PostScript, without installing other software.
I don't know, in advance, witch station will use this functionality (To create PS files) and on witch station I need to install the driver.

If there is not other possibility, I will use your solution ...

Thanks a new time

···

On Wednesday 17 September 2008 07:20:14 am Hugues JEAN-BAPTISTE wrote:

--

Hugues JEAN-BAPTISTE (hjb@agorinfo.fr)
AGORINFO S.A.S. (http://www.agorinfo.fr)

I'm not sure about this bit of info it comes from deep within my head. But I
think reportlab creates a PS file. I don't recall much more that.

···

On Wednesday 17 September 2008 10:50:27 am Hugues JEAN-BAPTISTE wrote:

johnf a écrit :
> On Wednesday 17 September 2008 07:20:14 am Hugues JEAN-BAPTISTE wrote:
>> Hi All,
>>
>> I try to print in a postscript file.
>> The idea is to create a PostScript file under MSW, put it with SAMBA on
>> Linux machine and a cron will convert it later in a pdf file.
>> May be it is not possible ?
>> This next code does not work, no error, but no file "essai.ps"
>> (MS-Vista, Python 2.4.4, wxPython 2.6.3.3 ansi) :
>>
>> def OnBtRen(self, evt):
>> fp = open('essai.html', 'r')
>> texte = fp.read()
>> fp.close()
>> prd = wx.PrintData()
>> prd.SetPrintMode(wx.PRINT_MODE_FILE)
>> prd.SetFilename('essai.ps')
>> psdc = wx.PostScriptDC(prd)
>> prp = wx.html.HtmlPrintout('Essai')
>> prp.SetDC(psdc)
>> prp.SetHtmlText(texte)
>> printer = wx.Printer()
>> printer.Print(self, prp, False)
>>
>> Thank you in advance if somebody has an idea or stop me if it is not
>> possible ...
>>
>> Friendly.
>
> I do most of this all the time. The steps I use are a little different.
> 1. I print to an adobe generic postscript printer (does not matter what
> I'm printing) - it creates a postscript file.
>
> 2. I process the postscript file with (windows) ghostscript - it creates
> the PDF.
>
> 3. I then forward it to a smtp server (email) and it is sent as an
> attachment.

Yes, thank you, this works ...

But, the problem is this necessary to install a PostScript driver (On
Vista).
So my dream was to use the capability of wxPython to create PostScript,
without installing other software.
I don't know, in advance, witch station will use this functionality (To
create PS files) and on witch station I need to install the driver.

If there is not other possibility, I will use your solution ...

Thanks a new time

--
John Fabiani

Hugues JEAN-BAPTISTE wrote:

Hi All,

I try to print in a postscript file.
The idea is to create a PostScript file under MSW, put it with SAMBA on Linux machine and a cron will convert it later in a pdf file.
May be it is not possible ?
This next code does not work, no error, but no file "essai.ps" (MS-Vista, Python 2.4.4, wxPython 2.6.3.3 ansi) :

   def OnBtRen(self, evt):
       fp = open('essai.html', 'r')
       texte = fp.read()
       fp.close()
       prd = wx.PrintData()
       prd.SetPrintMode(wx.PRINT_MODE_FILE)
       prd.SetFilename('essai.ps')
       psdc = wx.PostScriptDC(prd)
       prp = wx.html.HtmlPrintout('Essai')
       prp.SetDC(psdc)
       prp.SetHtmlText(texte)
       printer = wx.Printer()
       printer.Print(self, prp, False)

Thank you in advance if somebody has an idea or stop me if it is not possible ...

I'm not sure if resetting the DC in the HtmlPrintout is supposed to work or not. You may want to ask about it on the wx-users list to make sure.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!