Hi,
sorry for late answer, but I didn't have time to look at it.

On Thu, Jun 05, 2008 at 01:50:37PM +0200, David Leoni wrote:
> > On Thu, Dec 06, 2007 at 07:42:35PM +0100, Magyar B?lint wrote:
> > > Hello!
> >
> > Hi.
> > Sorry for late answer.
> >
> > >
> > > It seems I have misunderstood what "Page Metrics" actually means. What I
> > > want to do is crop the PDF's pages to a specified size, preferably while
> > > being able to arrange the contents of the page too (I want to shave off
> > > more from the inner margins than the outer margins).
> >
> > What do you mean by "arrange the contents of the page too"?
> > IIRC, Page Metrics specifies Media Box of the page. This means physical
> > geometry of the page.
> > >
> > > Is this possible with pdfedit? How?
> >
> > See example:
> > I have done:
> > Edit page metrics
> > Left upper corner, x position (mm) set to 30
> > Right bottom corber, x position (mm) set to 200
> >
> > Try to change revision to the older one and compare the difference.
> > Is this what you wanted?
[...]
> I understood how to crop a single page, but how can I apply the settings to
> all the pages in the document? If there's no GUI to do it, could somebody
> post a simple script to do the job?
> 
> I think such a feature would be very useful since around the net there are a
> lot of papers with little text at the center of the document and absurd
> unchangeable margins around - I really hate them

I agree with you and you can find patch attached to this email which
adds first scratch of such feature. It adds Page position and page count
fields to the page metrics dialog and applies given values to the all
pages in given range (starting with the specified page and continuing
with the following page count).

Please note that this patch is not complete at the moment - I would like
to have better and stronger page list specification (using ranges and
page number lists) as well as translation should be used there (you can
play with it and updated patch would appreciated).

Steps for installation:
You have basically two options here:
* update local version of the script (just for concrete user)
        - create ~/.pdfedit (if it doesn't exist yet)
        - copy $INSTALLATION_TARGET/share/pdfedit/dialogs.qs to
          ~/.pdfedit/
        - apply patch
                patch -p2 < multiple-page-metrics.patch

* update system wide version of the script
        - go to the sysem wide dialogs.qs 
        (cd $INSTALLATION_TARGET/share/pdfedit)
        - patch the file - same like above
        - note that you may need to be root for doing that

Best regards
-- 
Michal Hocko
editPageMediaBox currently works only with the scope of one page. Sometimes it
is very usefull to apply same values to the several pages at once.

This change was requested by user and it sounds reasonable.  Maybe we could use
better page specification (similar to the standard editors - like OO) with
ranges and lists.

This is just first implementation and maybe requires some better value
checking.

Index: src/gui/dialogs.qs
===================================================================
--- src/gui/dialogs.qs.orig	2008-06-09 14:34:40.000000000 +0200
+++ src/gui/dialogs.qs	2008-06-09 15:03:36.000000000 +0200
@@ -72,13 +72,23 @@ function editPageMediaBox() {
 									PageSpace.convertUnits(xright,"pt"), gb);
  var eyr = createNumberEditAndDisplay(tr("Right bottom corner")+", "+tr("y position")+"( "+PageSpace.getDefaultUnits()+" ): ",
 									PageSpace.convertUnits(yright,"pt"), gb);
+ // TODO translation
+ var pagePos = createNumberEditAndDisplay("Page", document.getPagePosition(page()), dialog);
+ var pageCount = createNumberEditAndDisplay("Page count", 1, dialog);
+
  if (!dialog.exec()) return;
 
  // Save media box
- page().setMediabox ( PageSpace.convertUnits( exl.value, undefined, "pt" ),
+ for (;pageCount.value > 0 && pagePos.value <= document.getPageCount(); --pageCount.value)
+ {
+   // FIXME remove
+   print("updating page:"+ pagePos.value);
+   var page = document.getPage(pagePos.value++);
+   page.setMediabox ( PageSpace.convertUnits( exl.value, undefined, "pt" ),
 						PageSpace.convertUnits( eyl.value, undefined, "pt" ),
 						PageSpace.convertUnits( exr.value, undefined, "pt" ),
 						PageSpace.convertUnits( eyr.value, undefined, "pt" ));
+ }
  print (tr("MediaBox changed."));
  go ();
 }
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Pdfedit-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pdfedit-support

Reply via email to