• How to get a uniform line width in PDF regardless of the device space a

    From Eremey Valetov@21:1/5 to All on Wed Oct 14 15:15:03 2020
    The width of a line in PDF is defined in terms of distances in the user space. In my use case, the aspect ratio of the device space (e.g. 4:3) is different from the aspect ratio of the user space (e.g. 1:1), which causes the line widths in the device
    space to be different in vertical and horizontal directions.

    For example, in the file "pic002_old.pdf" (screenshot in "pic002_old_fromPDF.png") in Filebin https://filebin.net/glx471sz2ehpe4ar the horizontal and vertical lines should be of the same width, but they're not. The vertical lines are thicker.

    I would like to perform scaling that only results in line width uniformity and does not affect anything else.

    I tried changing the stroke command 'S' to "q 1 0 0 1.5 0 0 cm S Q h", based on a solution that worked for me in PostScript. Here, 'q' saves the graphics state, "1 0 0 1.5 0 0 cm" scales the current transformation matrix, 'Q' restores the graphics state,
    and 'h' closes the current subpath. However, in addition to correctly scaling the line widths, this also scales the y-coordinates of the line endpoints by 1.5.

    What I need to get is shown in the picture "pic001_fromPDF.png" in Filebin https://filebin.net/glx471sz2ehpe4ar. This was obtained by converting a PostScript file to PDF and then doing a screenshot.

    But with "q 1 0 0 1.5 0 0 cm S Q h", I get the output as shown in the file "pic002_fromPDF.png" in Filebin https://filebin.net/glx471sz2ehpe4ar.

    Although my attempted solution did not work for PDF, something similar should work, because I tried converting PostScript where the issue was fixed in a very similar way to PDF, and the output looks OK, but I could not figure out what would be the human
    readable solution because the PDF file uses a stream object.

    How to make the line width uniform in the device space in PDF without affecting anything else?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From luserdroog@21:1/5 to Eremey Valetov on Thu Oct 22 15:39:01 2020
    On Wednesday, October 14, 2020 at 5:15:04 PM UTC-5, Eremey Valetov wrote:

    Although my attempted solution did not work for PDF, something similar should work, because I tried converting PostScript where the issue was fixed in a very similar way to PDF, and the output looks OK, but I could not figure out what would be the
    human readable solution because the PDF file uses a stream object.

    You should be able to pipe the stream contents through a Flate decoder
    to see what's in there.

    $ cat deflate
    #! /bin/sh

    gsnd -dNOSAFER -q \
    -c "(%stdin)(r)file/FlateDecode filter \
    80 string{2 copy readstring not{print exit}if print}loop quit"

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)