Python Forum
How to properly scale text in postscript conversion to pdf?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to properly scale text in postscript conversion to pdf?
#1
Hi all,

I have a question about Ghostscript postscript2pdf conversion. My setup is:
  • drawing a drawing with text on the tkinter canvas
  • exporting the drawing as postscript
  • converting using ps2pdfwr or Ghostscript
During the conversion text scales a bit bigger causing the white background of the text to be too small for the text. Is there a way to calculate the difference in font-size? I did try to set the text to a smaller font-size when exporting but it is not a solution since the drawing itself can be in different scales. I am looking for some kind of documentation about the postscript conversion and why it chooses a bigger font-size? Maybe there is a way to correct it if I know the right factor?

Cheers, Philip
Reply
#2
Do you have an example postscript file that isn't well converted by ghostscript?
Reply
#3
(Nov-07-2022, 12:28 PM)Gribouillis Wrote: Do you have an example postscript file that isn't well converted by ghostscript?
In the zipfile a screenshot from the tkinter canvas and the result in postscript. I see the text scaling is already in the ps file...

Attached Files

.zip   testext.zip (Size: 34.89 KB / Downloads: 119)
Reply
#4
(Nov-07-2022, 01:15 PM)philipbergwerf Wrote:
(Nov-07-2022, 12:28 PM)Gribouillis Wrote: Do you have an example postscript file that isn't well converted by ghostscript?
In the zipfile a screenshot from the tkinter canvas and the result in postscript. I see the text scaling is already in the ps file...
I found the answer, I overlooked a setting in the postscript named 'fontmap'.
I added fontmap='-*-Courier-Bold-R-Normal--*-120-*' to the postscript function and now it works properly!
Gribouillis likes this post
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Text conversion to lowercase is not working ineuw 3 481 Jan-16-2024, 02:42 AM
Last Post: ineuw
  KeyError: 0 when trying to dedupe and match records at scale Catalytic 1 2,192 Apr-07-2022, 06:34 PM
Last Post: deanhystad
  Matplotlib scale julienhofmann 0 1,815 Apr-04-2021, 08:50 AM
Last Post: julienhofmann
  Not able to update y2 axis scale in plotly ankitawadhwa 0 1,968 Jan-27-2020, 06:44 PM
Last Post: ankitawadhwa
  Change the scale on a Matplotlib Interactive Graph khatharsis 0 2,862 Oct-13-2019, 06:14 AM
Last Post: khatharsis
  How to manually define color bar scale in seaborn heatmap SriRajesh 3 18,354 Sep-08-2019, 11:12 AM
Last Post: RudraMohan
  python decimal scale precision massimo_m 5 5,445 Aug-22-2019, 11:47 AM
Last Post: perfringo
  Extend the scale Krszt 1 2,712 Nov-05-2018, 01:16 PM
Last Post: Gribouillis
  Python Classes or Functions for large scale application ? Vithulan 5 4,585 Oct-23-2017, 04:48 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020