emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Agenda printing: org-agenda-write doesn't use ps-paper-type
@ 2013-06-12  1:04 Myles English
  2013-06-12  7:31 ` Christian Egli
  0 siblings, 1 reply; 15+ messages in thread
From: Myles English @ 2013-06-12  1:04 UTC (permalink / raw)
  To: Emacs-orgmode

Hello,

Trying to print an agenda to pdf always results in the paper size being
US letter even though ps-paper-type is set to a4.

This is how I try to print it:

(org-agenda-write "/home/myles/tmp/agenda.pdf" nil nil "*Org Agenda(a)*")

and setting this doesn't fix it either:

(eval-after-load "ps-print"
  '(setq ps-paper-type 'a4))

Is there something else I need to customise?

Thanks,

Myles

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12  1:04 Agenda printing: org-agenda-write doesn't use ps-paper-type Myles English
@ 2013-06-12  7:31 ` Christian Egli
  2013-06-12 10:06   ` Myles English
  0 siblings, 1 reply; 15+ messages in thread
From: Christian Egli @ 2013-06-12  7:31 UTC (permalink / raw)
  To: emacs-orgmode

Myles English <mylesenglish@gmail.com> writes:

> Trying to print an agenda to pdf always results in the paper size being
> US letter even though ps-paper-type is set to a4.
>
> This is how I try to print it:
>
> (org-agenda-write "/home/myles/tmp/agenda.pdf" nil nil "*Org Agenda(a)*")

org-agenda-write uses ps-print to do the work so setting ps-paper-type
should indeed help.

> and setting this doesn't fix it either:
>
> (eval-after-load "ps-print"
>   '(setq ps-paper-type 'a4))
>

Have you tried setting this variable with the custom interface, i.e. M-x
customize-variable RET ps-paper-type RET?

HTH
Christian
-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12  7:31 ` Christian Egli
@ 2013-06-12 10:06   ` Myles English
  2013-06-12 16:01     ` Eric S Fraga
  0 siblings, 1 reply; 15+ messages in thread
From: Myles English @ 2013-06-12 10:06 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode


Hi Christian,

Christian Egli writes:

> Myles English <mylesenglish@gmail.com> writes:
>
>> Trying to print an agenda to pdf always results in the paper size being
>> US letter even though ps-paper-type is set to a4.

> Have you tried setting this variable with the custom interface, i.e. M-x
> customize-variable RET ps-paper-type RET?

The customise interface shows that ps-paper-type is indeed set to a4,
but still the agenda prints on US letter.

Any other ideas?

Myles

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12 10:06   ` Myles English
@ 2013-06-12 16:01     ` Eric S Fraga
  2013-06-12 21:57       ` Myles English
  0 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2013-06-12 16:01 UTC (permalink / raw)
  To: Myles English; +Cc: emacs-orgmode, Christian Egli

Myles English <mylesenglish@gmail.com> writes:

> Hi Christian,
>
> Christian Egli writes:
>
>> Myles English <mylesenglish@gmail.com> writes:
>>
>>> Trying to print an agenda to pdf always results in the paper size being
>>> US letter even though ps-paper-type is set to a4.
>
>> Have you tried setting this variable with the custom interface, i.e. M-x
>> customize-variable RET ps-paper-type RET?
>
> The customise interface shows that ps-paper-type is indeed set to a4,
> but still the agenda prints on US letter.

Have you checked to see if the postscript version uses the right paper
size?  Just in case the ps -> pdf conversion is at fault?  The pdf is
created from the ps file.  In any case, both ps and pdf work just fine
for me to A4 with ps-paper-type set to 'a4.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.3-193-g334581

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12 16:01     ` Eric S Fraga
@ 2013-06-12 21:57       ` Myles English
  2013-06-13  7:50         ` Eric S Fraga
                           ` (2 more replies)
  0 siblings, 3 replies; 15+ messages in thread
From: Myles English @ 2013-06-12 21:57 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode, Christian Egli


Eric S Fraga writes:

>>> Myles English <mylesenglish@gmail.com> writes:
>>>
>>>> Trying to print an agenda to pdf always results in the paper size being
>>>> US letter even though ps-paper-type is set to a4.
>
> Have you checked to see if the postscript version uses the right paper
> size?  Just in case the ps -> pdf conversion is at fault?  The pdf is
> created from the ps file.  In any case, both ps and pdf work just fine
> for me to A4 with ps-paper-type set to 'a4.

Thanks for checking it.  Yes, I had to change this line in
org-agenda.el:

- (call-process "ps2pdf" nil nil nil
+ (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"

I wonder if we need to allow a set of options to be passed to ps2pdf as
we do for ps?

Myles

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12 21:57       ` Myles English
@ 2013-06-13  7:50         ` Eric S Fraga
  2013-06-13 20:39           ` Myles English
  2013-06-13  8:11         ` Christian Egli
  2013-06-14  7:57         ` Sebastien Vauban
  2 siblings, 1 reply; 15+ messages in thread
From: Eric S Fraga @ 2013-06-13  7:50 UTC (permalink / raw)
  To: Myles English; +Cc: emacs-orgmode, Christian Egli

Myles English <mylesenglish@gmail.com> writes:

[...]

> Thanks for checking it.  Yes, I had to change this line in
> org-agenda.el:
>
> - (call-process "ps2pdf" nil nil nil
> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"

If you use a4 sized paper all (or most of) the time, you can set this in
/etc/papersize on Linux.  I think this is what ps2pdf looks at by
default.

I think paperconfig (8) is used to set this property properly.

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.3-193-g334581

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12 21:57       ` Myles English
  2013-06-13  7:50         ` Eric S Fraga
@ 2013-06-13  8:11         ` Christian Egli
  2013-06-13 13:32           ` Rainer Stengele
  2013-06-13 20:30           ` Myles English
  2013-06-14  7:57         ` Sebastien Vauban
  2 siblings, 2 replies; 15+ messages in thread
From: Christian Egli @ 2013-06-13  8:11 UTC (permalink / raw)
  To: Myles English; +Cc: emacs-orgmode

Myles English <mylesenglish@gmail.com> writes:

> Thanks for checking it.  Yes, I had to change this line in
> org-agenda.el:
>
> - (call-process "ps2pdf" nil nil nil
> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"
>
> I wonder if we need to allow a set of options to be passed to ps2pdf as
> we do for ps?

Where do we pass options for ps? A quick rgrep shows that ps2pdf is used
in the agenda and two of the exporters (groff and man) so a better
option might be to set the papersize via the environment (GS_OPTIONS).

Christian

-- 
Christian Egli
Swiss Library for the Blind, Visually Impaired and Print Disabled
Grubenstrasse 12, CH-8045 Zürich, Switzerland

-----
Tag der offenen Tuer
Die SBS laedt Sie herzlich ein: 29. Juni 2013 von 9 bis 16 Uhr.
Mehr Informationen erhalten Sie unter http://www.sbs.ch/offenetuer

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-13  8:11         ` Christian Egli
@ 2013-06-13 13:32           ` Rainer Stengele
  2013-06-13 20:30           ` Myles English
  1 sibling, 0 replies; 15+ messages in thread
From: Rainer Stengele @ 2013-06-13 13:32 UTC (permalink / raw)
  To: Christian Egli; +Cc: Myles English, emacs-orgmode

Am 13.06.2013 10:11, schrieb Christian Egli:
> Myles English <mylesenglish@gmail.com> writes:
> 
>> Thanks for checking it.  Yes, I had to change this line in
>> org-agenda.el:
>>
>> - (call-process "ps2pdf" nil nil nil
>> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"
>>
>> I wonder if we need to allow a set of options to be passed to ps2pdf as
>> we do for ps?
> 

> Where do we pass options for ps? A quick rgrep shows that ps2pdf is used
> in the agenda and two of the exporters (groff and man) so a better
> option might be to set the papersize via the environment (GS_OPTIONS).
> 
> Christian
> 
+1
under Windows I see the same problem and like to set to 'a4 somewhere.

Rainer

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-13  8:11         ` Christian Egli
  2013-06-13 13:32           ` Rainer Stengele
@ 2013-06-13 20:30           ` Myles English
  1 sibling, 0 replies; 15+ messages in thread
From: Myles English @ 2013-06-13 20:30 UTC (permalink / raw)
  To: Christian Egli; +Cc: emacs-orgmode


Christian Egli writes:

> Myles English <mylesenglish@gmail.com> writes:
>
>> Thanks for checking it.  Yes, I had to change this line in
>> org-agenda.el:
>>
>> - (call-process "ps2pdf" nil nil nil
>> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"
>>
>> I wonder if we need to allow a set of options to be passed to ps2pdf as
>> we do for ps?
>
> Where do we pass options for ps?

Ok, options aren't passed to ps but variables can be customised for the
emacs PostScript generator:

(customize-group "ps-print")

> A quick rgrep shows that ps2pdf is used in the agenda and two of the
> exporters (groff and man) so a better option might be to set the
> papersize via the environment (GS_OPTIONS).

This worked.  I added this to my ~/.zshrc :

export GS_OPTIONS="-sPAPERSIZE=a4"

Thanks,

Myles

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-13  7:50         ` Eric S Fraga
@ 2013-06-13 20:39           ` Myles English
  2013-06-13 21:59             ` Nick Dokos
  2013-06-14  9:03             ` Eric S Fraga
  0 siblings, 2 replies; 15+ messages in thread
From: Myles English @ 2013-06-13 20:39 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode, Christian Egli


Eric,

Eric S Fraga writes:

> Myles English <mylesenglish@gmail.com> writes:
>
>> Thanks for checking it.  Yes, I had to change this line in
>> org-agenda.el:
>>
>> - (call-process "ps2pdf" nil nil nil
>> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"
>
> If you use a4 sized paper all (or most of) the time, you can set this in
> /etc/papersize on Linux.  I think this is what ps2pdf looks at by
> default.
>
> I think paperconfig (8) is used to set this property properly.

Thanks for the suggestions.  I looked into this for my Arch Linux but it
had no effect on ps2pdf.  Making the /etc/papersize file and then
setting PAPERSIZE=a4 or PAPERCONF=/etc/papersize did not produce an A4
pdf document (even after installing libpaper).

Setting GS_OPTIONS="-sPAPERSIZE=a4" worked.

What also worked was manually adding this to the .ps file:

%%BeginPaperSize: a4
%%EndPaperSize

I am wondering if ps-print should have known to add this because
ps-paper-type is set to a4?

Thanks,
Myles

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-13 20:39           ` Myles English
@ 2013-06-13 21:59             ` Nick Dokos
  2013-06-14  9:03             ` Eric S Fraga
  1 sibling, 0 replies; 15+ messages in thread
From: Nick Dokos @ 2013-06-13 21:59 UTC (permalink / raw)
  To: emacs-orgmode

Myles English <mylesenglish@gmail.com> writes:

> Eric,
>
> Eric S Fraga writes:
>
>> Myles English <mylesenglish@gmail.com> writes:
>>
>>> Thanks for checking it.  Yes, I had to change this line in
>>> org-agenda.el:
>>>
>>> - (call-process "ps2pdf" nil nil nil
>>> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"
>>
>> If you use a4 sized paper all (or most of) the time, you can set this in
>> /etc/papersize on Linux.  I think this is what ps2pdf looks at by
>> default.
>>
>> I think paperconfig (8) is used to set this property properly.
>
> Thanks for the suggestions.  I looked into this for my Arch Linux but it
> had no effect on ps2pdf.  Making the /etc/papersize file and then
> setting PAPERSIZE=a4 or PAPERCONF=/etc/papersize did not produce an A4
> pdf document (even after installing libpaper).
>
> Setting GS_OPTIONS="-sPAPERSIZE=a4" worked.
>
> What also worked was manually adding this to the .ps file:
>
> %%BeginPaperSize: a4
> %%EndPaperSize
>
> I am wondering if ps-print should have known to add this because
> ps-paper-type is set to a4?
>
> Thanks,
> Myles
>
>

Just as another possibility: if there is no cleaner way, one
quick-and-dirty workaround for such problems (this one, the latex
preview/mint-requires-shell-escape one, etc.) is to have little personal
wrapper scripts that call the "real" program and pass the appropriate
args.  E.g. create ~/bin/ps2pdf containing

--8<---------------cut here---------------start------------->8---
#! /bin/bash

/usr/bin/ps2pdf -sPAPERSIZE=a4 $*
--8<---------------cut here---------------end--------------->8---

make it executable and make sure that ~/bin is before /usr/bin in your
PATH. call-process calls ps2pfs which resolves to ~/bin/ps2pdf and that
one calls /usr/bin/ps2pdf - be sure to use the full pathname here or all
hell will break loose.

This has the potential of creating a lot of confusion, so I wouldn't do
it if there is another way (as there is in this case), but if one is
getting desperate...

-- 
Nick

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-12 21:57       ` Myles English
  2013-06-13  7:50         ` Eric S Fraga
  2013-06-13  8:11         ` Christian Egli
@ 2013-06-14  7:57         ` Sebastien Vauban
  2013-06-14 11:41           ` Myles English
  2 siblings, 1 reply; 15+ messages in thread
From: Sebastien Vauban @ 2013-06-14  7:57 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Myles English wrote:
> Eric S Fraga writes:
>>>> Myles English <mylesenglish-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> writes:
>>>>> Trying to print an agenda to pdf always results in the paper size being
>>>>> US letter even though ps-paper-type is set to a4.
>>
>> Have you checked to see if the postscript version uses the right paper
>> size?  Just in case the ps -> pdf conversion is at fault?  The pdf is
>> created from the ps file.  In any case, both ps and pdf work just fine
>> for me to A4 with ps-paper-type set to 'a4.
>
> Thanks for checking it.  Yes, I had to change this line in
> org-agenda.el:
>
> - (call-process "ps2pdf" nil nil nil
> + (call-process "ps2pdf" nil nil nil "-sPAPERSIZE=a4"
>
> I wonder if we need to allow a set of options to be passed to ps2pdf as
> we do for ps?

And setting that in a custom command?

#+begin_src emacs-lisp
  (add-to-list 'org-agenda-custom-commands
               '("L" "Call list"
                 tags-todo "phone"
                 ((ps-paper-type 'a4))
                 ("~/org-calls.pdf")) t)
#+end_src

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-13 20:39           ` Myles English
  2013-06-13 21:59             ` Nick Dokos
@ 2013-06-14  9:03             ` Eric S Fraga
  1 sibling, 0 replies; 15+ messages in thread
From: Eric S Fraga @ 2013-06-14  9:03 UTC (permalink / raw)
  To: Myles English; +Cc: emacs-orgmode, Christian Egli

Myles English <mylesenglish@gmail.com> writes:

> Eric,
>
> Eric S Fraga writes:
>> If you use a4 sized paper all (or most of) the time, you can set this in
>> /etc/papersize on Linux.  I think this is what ps2pdf looks at by
>> default.
>>
> Thanks for the suggestions.  I looked into this for my Arch Linux but it
> had no effect on ps2pdf.  Making the /etc/papersize file and then
> setting PAPERSIZE=a4 or PAPERCONF=/etc/papersize did not produce an A4
> pdf document (even after installing libpaper).

On my Debian system, the file /etc/papersize has simply "a4" as the
contents.  No "PAPERSIZE" or similar.  According to the manual page for
papersize in section 5, this file is used unless overridden by the
environment variables PAPERSIZE or PAPERCONF, the latter pointing to a
file which specifies the size.

YMMV, of course.

Anyway, glad you sorted out your problem!

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.0.3-193-g334581

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-14  7:57         ` Sebastien Vauban
@ 2013-06-14 11:41           ` Myles English
  2013-06-14 11:51             ` Sebastien Vauban
  0 siblings, 1 reply; 15+ messages in thread
From: Myles English @ 2013-06-14 11:41 UTC (permalink / raw)
  To: Sebastien Vauban; +Cc: emacs-orgmode


Hi Seb,

Sebastien Vauban writes:

> Myles English wrote:
>>
>> I wonder if we need to allow a set of options to be passed to ps2pdf as
>> we do for ps?
>
> And setting that in a custom command?
>
> #+begin_src emacs-lisp
>   (add-to-list 'org-agenda-custom-commands
>                '("L" "Call list"
>                  tags-todo "phone"
>                  ((ps-paper-type 'a4))
>                  ("~/org-calls.pdf")) t)
> #+end_src

Sorry I don't understand what you mean.  The ps-paper-type is already
set to a4 but has no effect on the call to ps2pdf.

Myles

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: Agenda printing: org-agenda-write doesn't use ps-paper-type
  2013-06-14 11:41           ` Myles English
@ 2013-06-14 11:51             ` Sebastien Vauban
  0 siblings, 0 replies; 15+ messages in thread
From: Sebastien Vauban @ 2013-06-14 11:51 UTC (permalink / raw)
  To: emacs-orgmode-mXXj517/zsQ

Hi Myles,

Myles English wrote:
> Sebastien Vauban writes:
>> Myles English wrote:
>>>
>>> I wonder if we need to allow a set of options to be passed to ps2pdf as
>>> we do for ps?
>>
>> And setting that in a custom command?
>>
>> #+begin_src emacs-lisp
>>   (add-to-list 'org-agenda-custom-commands
>>                '("L" "Call list"
>>                  tags-todo "phone"
>>                  ((ps-paper-type 'a4))
>>                  ("~/org-calls.pdf")) t)
>> #+end_src
>
> Sorry I don't understand what you mean.  The ps-paper-type is already
> set to a4 but has no effect on the call to ps2pdf.

OK, seems I've read too fast...

Best regards,
  Seb

-- 
Sebastien Vauban

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2013-06-14 11:51 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-06-12  1:04 Agenda printing: org-agenda-write doesn't use ps-paper-type Myles English
2013-06-12  7:31 ` Christian Egli
2013-06-12 10:06   ` Myles English
2013-06-12 16:01     ` Eric S Fraga
2013-06-12 21:57       ` Myles English
2013-06-13  7:50         ` Eric S Fraga
2013-06-13 20:39           ` Myles English
2013-06-13 21:59             ` Nick Dokos
2013-06-14  9:03             ` Eric S Fraga
2013-06-13  8:11         ` Christian Egli
2013-06-13 13:32           ` Rainer Stengele
2013-06-13 20:30           ` Myles English
2013-06-14  7:57         ` Sebastien Vauban
2013-06-14 11:41           ` Myles English
2013-06-14 11:51             ` Sebastien Vauban

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).