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: 335)
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
  PDFminer outputs unreadable text during conversion from PDF to TXT Gromila131 6 1,730 Aug-06-2024, 08:20 AM
Last Post: Pedroski55
  How to change a tkinter label with scale and how to save that new value for later? bkeith 3 2,079 Jun-28-2024, 01:35 AM
Last Post: deanhystad
  Text conversion to lowercase is not working ineuw 3 1,376 Jan-16-2024, 02:42 AM
Last Post: ineuw
  KeyError: 0 when trying to dedupe and match records at scale Catalytic 1 4,401 Apr-07-2022, 06:34 PM
Last Post: deanhystad
  Matplotlib scale julienhofmann 0 2,427 Apr-04-2021, 08:50 AM
Last Post: julienhofmann
  Not able to update y2 axis scale in plotly ankitawadhwa 0 2,448 Jan-27-2020, 06:44 PM
Last Post: ankitawadhwa
  Change the scale on a Matplotlib Interactive Graph khatharsis 0 3,777 Oct-13-2019, 06:14 AM
Last Post: khatharsis
  How to manually define color bar scale in seaborn heatmap SriRajesh 3 21,294 Sep-08-2019, 11:12 AM
Last Post: RudraMohan
  python decimal scale precision massimo_m 5 7,436 Aug-22-2019, 11:47 AM
Last Post: perfringo
  Extend the scale Krszt 1 3,529 Nov-05-2018, 01:16 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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