# OpenPrinter not working on Xojo2018r4

**URL:** <https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168>\
**Category:** General\
**Created:** [June 28, 2019, 2:13pm UTC](https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168 "2019-06-28T14:13:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sebastian\_Kapellas](https://forum.xojo.com/user_avatar/forum.xojo.com/sebastian_kapellas/32/1631_2.png) [@Sebastian\_Kapellas](https://forum.xojo.com/u/Sebastian_Kapellas)\
**Post date:** [June 28, 2019, 2:13pm UTC](https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168/1 "2019-06-28T14:13:27Z")

</div>

Hello Everyone,

I just moved on from Xojo 2016r3 to Xojo 2018r4 on my project and without changing anything OpenPrinter method throws exception.

Common\runprint.cpp: 180  
Failure Condition: returnGfx

My Code

```
If ivPrPrinterId>0 Then
  Dim s As String
  s = "KPRINTER_"+ivPrPrinterId.toString()
  If rgPrinterSetupGet(ps, s) Then
  End If
End If

ivGraphics = OpenPrinter(ps) // Pending to remove the "Dialog"

```

Public Method (byRef ps As PrinterSetup, configType As String = “GenericInvoicePrinterSetup”) returns Boolean

Dim s As String

If Not(GetConfigValue(configType, s)) Then  
Return False  
End If

If s = “” Then  
Return False  
End If  
s = DefineEncoding(s, Encodings.ASCII)  
'MsgBox(s.Encoding.internetName)  
Dim mb As MemoryBlock = DecodeBase64(s)

Try  
ps.SetupString = mb  
Catch e As IOException  
Return False  
End Try

Return True

Above is the code where I save my PrinterSetup

Dim mb As MemoryBlock

mb = ps.SetupString

Dim s As String

s = DefineEncoding(EncodeBase64(mb), Encodings.ASCII)

Return PutConfigValue(configType, s)

Has anyone come up with this one?

Thank you in advance.

---

<div class="post-metadata">

**Author:** ![Jürg\_Otter](https://forum.xojo.com/user_avatar/forum.xojo.com/j%C3%BCrg_otter/32/584_2.png) [@Jürg\_Otter](https://forum.xojo.com/u/J%C3%BCrg_Otter)\
**Post date:** [June 28, 2019, 2:33pm UTC](https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168/2 "2019-06-28T14:33:36Z")

</div>

If this is about TargetWindows…

> [@](#):
>
> 2016r3 → 2018r4

Thats bye, bye GDI - Hello Direct2D

> [@](#):
>
> GetConfigValue

Are you trying to pass in a PrinterSetup/String youve saved in 2016r3/GDI?  
Then thats not going to work (as far as i remember from reading the forums). Youll have to get a new one for the Direct2D Xojo versions.

---

<div class="post-metadata">

**Author:** ![Rick\_Araujo](https://forum.xojo.com/user_avatar/forum.xojo.com/rick_araujo/32/251_2.png) [@Rick\_Araujo](https://forum.xojo.com/u/Rick_Araujo)\
**Post date:** [July 1, 2019, 8:20pm UTC](https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168/3 "2019-07-01T20:20:28Z")

</div>

I recommend to skip anything between 2016r3 and 2019r1.1. Move to 2019r1.1 if you can.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Kapellas](https://forum.xojo.com/user_avatar/forum.xojo.com/sebastian_kapellas/32/1631_2.png) [@Sebastian\_Kapellas](https://forum.xojo.com/u/Sebastian_Kapellas)\
**Post date:** [July 2, 2019, 7:04am UTC](https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168/4 "2019-07-02T07:04:16Z")

</div>

I have saved again the PrinterSetup without the encoding and it worked.  
The only thing that I have to mention is that when you use for example the XPS and it opens the window to save the file.  
If you press Cancel then Xojo throws that something went wrong and the application closes.  
If you save the file everything work ok.

Rick my plan is to use 2019r1.1 but because we have the MBS plugins for 2018 r4 I tried to move on first on 2018 r4 and when everything works ok then we will move on to 2019r1.1  
Thank you for your advice 🙂

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 3:59pm UTC](https://forum.xojo.com/t/openprinter-not-working-on-xojo2018r4/49168/5 "2021-04-29T15:59:47Z")

</div>


