vim / vim

The official Vim repository
https://www.vim.org
Vim License
36.82k stars 5.47k forks source link

Postscript files always have Portrait orientation #16156

Open mx518 opened 3 days ago

mx518 commented 3 days ago

Steps to reproduce

echo test > test.txt vim -c "set printoptions=portrait:n | ha > lan.ps | q" test.txt && ps2pdf lan.ps vim -c "set printoptions=portrait:y | ha > por.ps | q" test.txt && ps2pdf por.ps

Expected behaviour

Expectingt that the .ps files have different orientations, however both show: %%Orientation: Portrait pdf also only rotates the text, not the page. image

Version of Vim

9.0-1-1378, 1499

Environment

WSL

Logs and stack traces

No response

chrisbra commented 20 hours ago

Hm, can you test the following change please?

diff --git a/src/hardcopy.c b/src/hardcopy.c
index 8abfff210..785a3f554 100644
--- a/src/hardcopy.c
+++ b/src/hardcopy.c
@@ -2742,7 +2742,7 @@ mch_print_begin(prt_settings_T *psettings)

     prt_dsc_textline("CreationDate", get_ctime(time(NULL), FALSE));
     prt_dsc_textline("DocumentData", "Clean8Bit");
-    prt_dsc_textline("Orientation", "Portrait");
+    prt_dsc_textline("Orientation", prt_portrait ? "Portrait" : "Landscape");
     prt_dsc_atend("Pages");
     prt_dsc_textline("PageOrder", "Ascend");
     // The bbox does not change with orientation - it is always in the default
mx518 commented 8 hours ago

Thanks, LGTM!

image