PDFedit Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000290 [GUI] =Other (GUI)= major always 02-21-09 21:43 03-09-09 10:17
Reporter Eric Doviak View Status public  
Assigned To hockm0bm
Priority normal Resolution fixed  
Status resolved  
Summary 0000290: "Edit page metrics" should transform both CropBox and MediaBox
Description I frequently receive PDF files with pages that are 5 inches by 8 inches (i.e. 12.7 cm by 20.32 cm). While they look nice on screen, the text is terribly small on the printed page and the printed page contains irritatingly large white margins, so I developed PDFCrop (pdfcrop.sourceforge.net) to obtain nice printed pages. Your project has far more potential than mine however, so I'd like to obtain the same functionality from PDFEdit.

Fortunately, PDFEdit already has the necessary functionality. It just needs a slightly better implementation.

Specifically, I want to enlarge the page from 5 by 8 inches to 8.5 by 11 inches. To do that in PDFEdit 0.4.2, I use "Edit page metrics" (to enlarge the page) and "Set page transformation matrix" (to enlarge the text).

In practice, it appears to work, but when you open the PDF file outside of PDFEdit, the text is enlarged but the page is not. After much experimentation, I discovered that the error occurs because the changes to the MediaBox are not applied to the CropBox. (To make the necessary fixes, you have to open the object tree, expand "Pages," expand the page numbers, expand "Dictionary" and copy the values from "MediaBox" to "CropBox").

In the next release of PDFEdit, could you please have "Edit page metrics" transform both CropBox and MediaBox? A person who is trying to reduce the size of a page will not notice the difference, but a person (like me) who is trying to enlarge a page will notice.

Thank you for all of the great work you have done. It is greatly appreciated.

Sincerely,
- Eric Doviak

Additional Information
Attached Files  crop_box-sync_with_media_box.patch [^] (5,130 bytes) 02-25-09 14:14

- Relationships

- Notes
(0000672)
hockm0bm
02-24-09 11:11

Just for reference, the complete definition of PDF page space can be found in PDF Specification document (10.10.1 Page boundaries).

I think that we can safely ignore (for now) ArtBox and BleedBox as they are ignored for casual desktop printer/display usage. In this case the CropBox and TrimBox should be same as MediaBox.

I think that we don't have to care much about other than desktop usage for now. If someone needs better control over *Box he/she can simply use property editor.

The patch will follow
 
(0000673)
hockm0bm
02-24-09 13:12

Eric,
could you try crop_box-sync_with_media_box.patch?
 
(0000677)
Eric Doviak
02-25-09 09:16

Hi Michal,

I applied the patch to the PDFEdit 0.4.2-3 source code in Debian Sid, built a new DEB and installed it.

The patch does the intended job. It applies the changes to both CropBox and MediaBox.

But now I'm running into bugs 0000291 and 0000295. The changes are not applied across the full range of pages that I specify and some of the pages are disappearing.

In the unpatched version, the "disappearing pages bug" had occurred when I used the "Edit page metrics" utility, but the unpatched version always applied the Media Box changes across the full range of pages that I specified.

I wonder why the "not full range bug" is suddenly appearing now.

I'm going to email the DEB to my work machine and see if I can reproduce the problem on that one. I probably won't be able to file another report until Thursday night (Friday morning for you), but I will keep you posted.

Thanks for your assistance!
- Eric
 
(0000678)
hockm0bm
02-25-09 14:14

> I wonder why the "not full range bug" is suddenly appearing now.

Because I was too fast with the patch which is not correct... It fails because I have used bad exception type. I am very sorry about that.

The updated patch will come in shortly (I will remove the original patch and replace it by the updated one).
 
(0000679)
hockm0bm
02-25-09 14:16

> The updated patch will come in shortly (I will remove the original patch and
> replace it by the updated one).

Done
 
(0000680)
hockm0bm
02-25-09 14:48

Btw.
I have tried to reproduce with following steps:
1) remove pages 27, 28, 29
2) remove page 1
3) edit page metrics: [0 0 612 792] for 26 pages starting with 1

And all pages have update size without any problems.
So I have checked differences with your document and it seems that you have done changes in several steps (there are 4 revisions which means that you have saved changes 3 times).

The first saved revision contains all 29 pages and all pages have updated size (with the CropBox not matching MediaBox).

The second revision still contains 29 pages but the page#2 is empty with:
Error (582387): Unknown compression method in flate stream
message on the console [*]
Besides that it seems that you have only updated CropBox and MediaBox to [-40 0 572 792].

The third revision only removes those 3 pages and replaces invalid stream reported above.

As you can see in [*], which might be rather technical so shortly: there is some bug which causes damage of the page content (I was able to reproduce by save followed by save as a new revision).

---
[*]which corresponds to the object [16 0] (content stream for this page) which is decoded even though it has FlateDecode filter. I was able to reproduce this situation with save followed by save as a new revision! Simple save or save as a new revision worked correctly.
 
(0000681)
hockm0bm
02-25-09 14:50

I think that page damage issue should be discussed in 0000295. So please try the new patch and we should close this issue if it works for you.
 
(0000688)
Eric Doviak
02-26-09 05:29

> And all pages have update size without any problems.

No problems here either!

> So please try the new patch and we should close this issue if it
> works for you.

The patch works, so this bug should be closed.

> Because I was too fast with the patch which is not correct... It fails
> because I have used bad exception type. I am very sorry about that.

Don't apologize for doing me a favor. You have me feeling like a kid in the candy store. I can't tell you how happy I am. This is great!

> I think that page damage issue should be discussed in 0000295.

Will do!

Thanks!
- Eric
 
(0000689)
Eric Doviak
02-26-09 05:32

The patch works!

Thank you so much!
- Eric
 
(0000693)
hockm0bm
02-26-09 09:23

I am waiting for ACK from Jozo to commit the patch to the CVS
 
(0000715)
Eric Doviak
02-28-09 02:19

My mistake. I should have marked this issue "resolved."
 
(0000729)
hockm0bm
03-09-09 10:17

Patch is already in the CVS.
 

- Issue History
Date Modified Username Field Change
02-21-09 21:43 Eric Doviak New Issue
02-24-09 10:59 hockm0bm Status new => assigned
02-24-09 10:59 hockm0bm Assigned To  => hockm0bm
02-24-09 11:11 hockm0bm Note Added: 0000672
02-24-09 13:12 hockm0bm File Added: crop_box-sync_with_media_box.patch
02-24-09 13:12 hockm0bm Note Added: 0000673
02-25-09 09:16 Eric Doviak Note Added: 0000677
02-25-09 14:14 hockm0bm Note Added: 0000678
02-25-09 14:14 hockm0bm File Deleted: crop_box-sync_with_media_box.patch
02-25-09 14:14 hockm0bm File Added: crop_box-sync_with_media_box.patch
02-25-09 14:16 hockm0bm Note Added: 0000679
02-25-09 14:48 hockm0bm Note Added: 0000680
02-25-09 14:50 hockm0bm Note Added: 0000681
02-26-09 05:29 Eric Doviak Note Added: 0000688
02-26-09 05:32 Eric Doviak Status assigned => closed
02-26-09 05:32 Eric Doviak Note Added: 0000689
02-26-09 05:32 Eric Doviak Resolution open => fixed
02-26-09 09:23 hockm0bm Note Added: 0000693
02-28-09 02:19 Eric Doviak Status closed => resolved
02-28-09 02:19 Eric Doviak Note Added: 0000715
03-09-09 10:17 hockm0bm Note Added: 0000729