Print preview and print PDF in PyQT5

Justin Giffard <[email protected]> Fri, 12 Jun 2020 13:08:08 +0200
Newsgroups gmane.comp.python.pyqt-pykde
Message-ID <CABN1b7oL0RpR_-C0S-Mx3yaHQJrxMAc1=Pxa2oDJXQwk2foZ_A@mail.gmail.com>
--000000000000404dd605a7e118e0
Content-Type: text/plain; charset="UTF-8"

Good afternoon

I'm looking for a way to make a print preview and print a PDF. I've tried
various things including trying to use a webview and print from there
without much success.

Currently I am generating a PDF with reportlab but ideally what I want is
to be able view the document after the pdf is generated (based on
data fetched from a database) and then if need be press cancel to alter the
parameters and then view it again then chose which printer I want to print
to and then print. Thus far I haven't had much luck other than making the
app open the document in an external browser / external PDF viewer and then
printing from there or blindly printing to the default printer.


I appreciate any advice

Justin

--000000000000404dd605a7e118e0
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">





<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">Good afternoon</p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">I&#39;m looking for a way to m=
ake a print preview and print a PDF. I&#39;ve tried various things includin=
g trying to use a webview and print from there without much success.</p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">Currently I am generating a PD=
F with=C2=A0reportlab but ideally=C2=A0what I want is to be able view the d=
ocument after the pdf is generated (based on data=C2=A0fetched from a datab=
ase) and then if need be press cancel to alter the parameters and then view=
 it again then chose which printer I want to=C2=A0print to and then print. =
Thus far I haven&#39;t had much luck other than making the app open the doc=
ument in an external browser / external PDF viewer and then printing from t=
here or blindly printing to the default printer.</p>
<p class=3D"gmail-p2" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;;min-height:14px"><br></p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">I appreciate any advice</p>
<p class=3D"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-=
variant-east-asian:normal;font-stretch:normal;font-size:12px;line-height:no=
rmal;font-family:&quot;Helvetica Neue&quot;">Justin</p></div>

--000000000000404dd605a7e118e0--