ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* rotating some pages of a pdf
@ 2017-01-04 20:31 Cesar Romani
  2017-01-04 21:50 ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Cesar Romani @ 2017-01-04 20:31 UTC (permalink / raw)
  To: ntg-context

I'm using the following code, rotate.tex, to rotate all the pages of
file.pdf, using: context --input=file.pdf --rotation=45 rotate.pdf

rotate.tex
==========
\getfiguredimensions [\getdocumentargument{input}]
\starttext
   \dorecurse{\noffigurepages}
     {\startTEXpage
       \externalfigure
         [\getdocumentargument{input}]
         [page=\recurselevel,
          orientation=\getdocumentargument{rotation}]
     \stopTEXpage}
\stoptext

How could I use this code to rotate, say, the page five, 7º clockwise,
and the page twenty, 15º counterclockwise?

Many thanks in advance,

-- 
Cesar

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: rotating some pages of a pdf
  2017-01-04 20:31 rotating some pages of a pdf Cesar Romani
@ 2017-01-04 21:50 ` Hans Hagen
  2017-01-04 23:34   ` Cesar Romani
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2017-01-04 21:50 UTC (permalink / raw)
  To: ntg-context

On 1/4/2017 9:31 PM, Cesar Romani wrote:
> I'm using the following code, rotate.tex, to rotate all the pages of
> file.pdf, using: context --input=file.pdf --rotation=45 rotate.pdf
>
> rotate.tex
> ==========
> \getfiguredimensions [\getdocumentargument{input}]
> \starttext
>   \dorecurse{\noffigurepages}
>     {\startTEXpage
>       \externalfigure
>         [\getdocumentargument{input}]
>         [page=\recurselevel,
>          orientation=\getdocumentargument{rotation}]
>     \stopTEXpage}
> \stoptext
>
> How could I use this code to rotate, say, the page five, 7º clockwise,
> and the page twenty, 15º counterclockwise?

\starttext

   \dorecurse{\noffigurepages}
     {\startTEXpage
       \doifelsesomething{\getdocumentargument{r\recurselevel}} {%
           \externalfigure
             [\getdocumentargument{input}]
             [page=\recurselevel,
              orientation=\getdocumentargument{r\recurselevel}]
         } {%
           \externalfigure
             [\getdocumentargument{input}]
             [page=\recurselevel,
              orientation=\getdocumentargument{rotation}]
         }%
     \stopTEXpage}

\stoptext


--r5=7 --r20=15 --rotation=45

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: rotating some pages of a pdf
  2017-01-04 21:50 ` Hans Hagen
@ 2017-01-04 23:34   ` Cesar Romani
  2017-01-05  9:14     ` Hans Hagen
  0 siblings, 1 reply; 7+ messages in thread
From: Cesar Romani @ 2017-01-04 23:34 UTC (permalink / raw)
  To: ntg-context

Thanks, it works fine.

I noticed that the resolution of the rotated pages decreases. Is there
any possibility to maintain or increase the resolution of the rotated
pages?

Many thanks in advance,

-- 
Cesar

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: rotating some pages of a pdf
  2017-01-04 23:34   ` Cesar Romani
@ 2017-01-05  9:14     ` Hans Hagen
  2017-01-06  4:47       ` Cesar Romani
  0 siblings, 1 reply; 7+ messages in thread
From: Hans Hagen @ 2017-01-05  9:14 UTC (permalink / raw)
  To: ntg-context

On 1/5/2017 12:34 AM, Cesar Romani wrote:
> Thanks, it works fine.
>
> I noticed that the resolution of the rotated pages decreases. Is there
> any possibility to maintain or increase the resolution of the rotated
> pages?

in what sense decrease ...

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: rotating some pages of a pdf
  2017-01-05  9:14     ` Hans Hagen
@ 2017-01-06  4:47       ` Cesar Romani
  2017-01-06 11:02         ` luigi scarso
  2017-01-06 15:31         ` Alan Braslau
  0 siblings, 2 replies; 7+ messages in thread
From: Cesar Romani @ 2017-01-06  4:47 UTC (permalink / raw)
  To: ntg-context

On 05/01/2017 04:14 a.m., Hans Hagen wrote:
 > On 1/5/2017 12:34 AM, Cesar Romani wrote:
 >> Thanks, it works fine.
 >>
 >> I noticed that the resolution of the rotated pages decreases. Is there
 >> any possibility to maintain or increase the resolution of the rotated
 >> pages?
 >
 > in what sense decrease ...

The quality of the rotated pdfs, which are images, drops off a little.
For example, some characters are not so sharp as in the original pdf.

If I use GraphicsMagick I would remedy this with the parameter -density
as in:
gm convert -density 300x300 original.pdf -rotate 45 rotated.pdf

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: rotating some pages of a pdf
  2017-01-06  4:47       ` Cesar Romani
@ 2017-01-06 11:02         ` luigi scarso
  2017-01-06 15:31         ` Alan Braslau
  1 sibling, 0 replies; 7+ messages in thread
From: luigi scarso @ 2017-01-06 11:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Fri, Jan 6, 2017 at 5:47 AM, Cesar Romani <cesar.romani@gmail.com> wrote:
> On 05/01/2017 04:14 a.m., Hans Hagen wrote:
>> On 1/5/2017 12:34 AM, Cesar Romani wrote:
>>> Thanks, it works fine.
>>>
>>> I noticed that the resolution of the rotated pages decreases. Is there
>>> any possibility to maintain or increase the resolution of the rotated
>>> pages?
>>
>> in what sense decrease ...
>
> The quality of the rotated pdfs, which are images, drops off a little.

Can you make a comparison with different viewer ?
Under Windows, you can take Adobe Reader as reference.


-- 
luigi
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: rotating some pages of a pdf
  2017-01-06  4:47       ` Cesar Romani
  2017-01-06 11:02         ` luigi scarso
@ 2017-01-06 15:31         ` Alan Braslau
  1 sibling, 0 replies; 7+ messages in thread
From: Alan Braslau @ 2017-01-06 15:31 UTC (permalink / raw)
  To: Cesar Romani; +Cc: mailing list for ConTeXt users

On Thu, 5 Jan 2017 23:47:00 -0500
Cesar Romani <cesar.romani@gmail.com> wrote:

> The quality of the rotated pdfs, which are images, drops off a little.
> For example, some characters are not so sharp as in the original pdf.
> 
> If I use GraphicsMagick I would remedy this with the parameter
> -density as in:
> gm convert -density 300x300 original.pdf -rotate 45 rotated.pdf

From the web:

"A PDF file does not have a density anyway. IM will apply a default
interpretation of 72dpi unless you override it (e.g. -density 300x300
-units pixelsperinch)."


Testing:

convert original.tif -rotate 45 rotated.png

keeps the original density.

1) original.tif was 6000x6000; rotated.png is 8488x8488 (2400dpi)
2) converting to rotated.tif fails
convert: TIFF: negative image positions unsupported rotated.tif @ error/tiff.c/WriteTIFFImage/3609.
3) converting to rotated.pdf does produce a much reduced resolution image.

Indeed, PDF is container, not the best format for manipulating bitmap images.
I take two approaches to this:
1) I manipulate/modify the images explicitly "upstream" before including them in ConTeXt,
   using any of my favorite tools; or
2) I manipulate/modify the images using MetaPost, within ConTeXt.
   This gives very satisfactory results and does not rely on ImageMagik.

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2017-01-06 15:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-04 20:31 rotating some pages of a pdf Cesar Romani
2017-01-04 21:50 ` Hans Hagen
2017-01-04 23:34   ` Cesar Romani
2017-01-05  9:14     ` Hans Hagen
2017-01-06  4:47       ` Cesar Romani
2017-01-06 11:02         ` luigi scarso
2017-01-06 15:31         ` Alan Braslau

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 NNTP newsgroup(s).