02-10-2009, 07:00 PM | #61 |
Interested Bystander
Posts: 3,726
Karma: 19728152
Join Date: Jun 2008
Device: Note 4, Kobo One
|
Development environment
(Deleted)
Last edited by murraypaul; 02-11-2009 at 02:28 PM. |
02-11-2009, 04:48 PM | #62 |
Interested Bystander
Posts: 3,726
Karma: 19728152
Join Date: Jun 2008
Device: Note 4, Kobo One
|
Odd text output on some pdfs
PaperCrop is giving incorrect output on some sections on some pdfs.
An example is attached. Has anyone worked out what causes this? A trace of the PDF decoding: Op = Tf:'F8', 1, Op = TD:8.473000, 0, Op = Tj:'publishes articles with a political or social', Op = TD:-12.350000, -1.198000, Op = Tc:-0.017000, Op = Tw:-0.022000, Op = TJ:['edge. WhereÕ', 75, 's the science? The three of them knew', 93, '.', ], Op = Tm:26.060000, 0, 0, 26.060000, 62.730000, 251.500000, Op = g:0.610000, Op = Tj:'M', Op = Tm:9.600000, 0, 0, 9.600000, 89.450000, 263, Op = g:0, Op = Tc:-0.013000, Op = Tw:-0.020000, Op = Tj:'arch had the world biting its nails that asteroid 1997 XF-11 might', Op = T*: Op = Tc:-0.012000, Op = Tw:0.058000, Op = TJ:['pass close enough to the ear', -8, 'th in 30 years to collide. (Reanalysis', ], Op = TD:-2.743000, -1.198000, Op = Tw:0.126000, Op = TJ:['promised a comfor', -6, 'table margin for safety', 87, '.) Then Hollywood staged a', ], Op = T*: Op = Tw:0.032000, Op = TJ:['summertime double featur', -6, 'e, with ', ], Op = Tf:'F10', 1, Op = TD:14.372000, 0, Op = Tj:'Deep Impact ', Op = Tf:'F8', 1, Op = TD:5.814000, 0, Op = Tj:'destroying the world by', Op = TD:-20.185000, -1.198000, Op = Tj:'comet in May and ', It is as though it has lost or corrupted the font info, and when the font gets reset everything looks ok again. Last edited by murraypaul; 02-11-2009 at 06:07 PM. |
Advert | |
|
02-11-2009, 07:08 PM | #63 |
Interested Bystander
Posts: 3,726
Karma: 19728152
Join Date: Jun 2008
Device: Note 4, Kobo One
|
I've tracked down a bit more on this.
When is happening is that the Tm command triggers a font update. Part of this update checks that the substituted font is roughly the same width as the intended font, and scales it if not. For the paragraphs in question the getGlyphAdvance call is returning a value greater than 1 (which shouldn't be possible), causing the font to be dramatically over-shrunk. This can be worked around by changing SplashOutputDev.cc, line 1177, to add a check for w2 <= 1. |
02-12-2009, 06:56 AM | #64 |
Interested Bystander
Posts: 3,726
Karma: 19728152
Join Date: Jun 2008
Device: Note 4, Kobo One
|
Cropping patch
Quick-and-dirty svn diff to enable four-sided cropping, with crop figures entered as percentages of width/height:
Index: papercrop-read-only.psm/PDFwin.cpp ================================================== ================= --- papercrop-read-only.psm/PDFwin.cpp (revision 2) +++ papercrop-read-only.psm/PDFwin.cpp (working copy) @@ -823,17 +823,17 @@ SummedAreaTable t(*bmp);//bmp->getWidth(), bmp->getHeight(), bmp->getDataPtr(), bmp- >getRowSize()); - TRect domain(0,0, bmp->GetWidth(), bmp->GetHeight()); - - - - FlLayout* layout=mLayout->findLayout("Automatic segmentation"); double min_gap_percentage=layout->findSlider("MIN gap")->value(); double margin_percentage=layout->findSlider("Margin")->value(); int thr_white=layout->findSlider("white point")->value(); + double cropT=layout->findSlider("Crop T")->value()/100.0; + double cropB=layout->findSlider("Crop B")->value()/100.0; + double cropL=layout->findSlider("Crop L")->value()/100.0; + double cropR=layout->findSlider("Crop R")->value()/100.0; double max_width=1.0/layout->findSlider("N columns")->value(); + TRect domain(cropL*bmp->GetWidth(),cropT*bmp->GetHeight(), (1-cropR)*bmp->GetWidth() , (1-cropB)*bmp->GetHeight()); ImageSegmentation s(t, true, domain, 0, min_gap_percentage, thr_white); s.segment(); @@ -994,4 +994,20 @@ temp.format("selected %d", mSelectedRect); fl_draw(temp, 0,0,w(), h(), FL_ALIGN_CENTER); */ + + FlLayout* layout=mLayout->findLayout("Automatic segmentation"); + double cropT=layout->findSlider("Crop T")->value()/100.0; + double cropB=layout->findSlider("Crop B")->value()/100.0; + double cropL=layout->findSlider("Crop L")->value()/100.0; + double cropR=layout->findSlider("Crop R")->value()/100.0; + + int wCropL=toWindowCoord(cropL,cropT).x; + int wCropT=toWindowCoord(cropL,cropT).y; + int wCropR=toWindowCoord(cropR,cropB).x; + int wCropB=toWindowCoord(cropR,cropB).y; + + fl_draw_box( FL_BORDER_FRAME, 0, 0, ww, wCropT, FL_BLACK); + fl_draw_box( FL_BORDER_FRAME, 0, hh-wCropB, ww, wCropB, FL_BLACK); + fl_draw_box( FL_BORDER_FRAME, 0, 0, wCropL, hh, FL_BLACK); + fl_draw_box( FL_BORDER_FRAME, ww-wCropR, 0, wCropR, hh, FL_BLACK); } Index: papercrop-read-only.psm/RightPanel.cpp ================================================== ================= --- papercrop-read-only.psm/RightPanel.cpp (revision 2) +++ papercrop-read-only.psm/RightPanel.cpp (working copy) @@ -61,6 +61,10 @@ double margin=L.getValue<double>("margin"); int nColumns=L.getValue<int>("N_columns"); int white_point=L.getValue<int>("white_point"); + double cropT=L.getValue<double>("crop_T"); + double cropB=L.getValue<double>("crop_B"); + double cropL=L.getValue<double>("crop_L"); + double cropR=L.getValue<double>("crop_R"); std::string option=L.getValue<std::string>("option"); FlLayout* layout=findLayout("Automatic segmentation"); @@ -68,6 +72,10 @@ layout->findSlider("Margin")->value(margin); layout->findSlider("N columns")->value(nColumns); layout->findSlider("white point")->value(white_point); + layout->findSlider("Crop T")->value(cropT); + layout->findSlider("Crop B")->value(cropB); + layout->findSlider("Crop L")->value(cropL); + layout->findSlider("Crop R")->value(cropR); find<Fl_Input>("Option_Input")->value(processOption(option.c_str())); redraw(); @@ -102,6 +110,18 @@ layout(0)->create("Value_Slider", "white point","white point"); layout(0)->slider(0)->range(230, 255); layout(0)->slider(0)->step(1); + layout(0)->create("Value_Slider", "Crop T","Crop T"); + layout(0)->slider(0)->range(0, 20); + layout(0)->slider(0)->step(0.1); + layout(0)->create("Value_Slider", "Crop B","Crop B"); + layout(0)->slider(0)->range(0, 20); + layout(0)->slider(0)->step(0.1); + layout(0)->create("Value_Slider", "Crop L","Crop L"); + layout(0)->slider(0)->range(0, 20); + layout(0)->slider(0)->step(0.1); + layout(0)->create("Value_Slider", "Crop R","Crop R"); + layout(0)->slider(0)->range(0, 20); + layout(0)->slider(0)->step(0.1); layout(0)->create("Button", "update","update"); layout(0)->updateLayout(); Index: papercrop-read-only.psm/presets/two-column papers (portrait).lua ================================================== ================= --- papercrop-read-only.psm/presets/two-column papers (portrait).lua (revision 2) +++ papercrop-read-only.psm/presets/two-column papers (portrait).lua (working copy) @@ -2,4 +2,8 @@ margin=1.45 N_columns=2 white_point=255 -option="(portrait) vertical scroll (outputs multiple images)" \ No newline at end of file +crop_T = 0 +crop_B = 0 +crop_L = 0 +crop_R = 0 +option="(portrait) vertical scroll (outputs multiple images)" |
02-13-2009, 10:30 AM | #65 |
Enthusiast
Posts: 27
Karma: 163
Join Date: Nov 2008
Device: Kobo wifi
|
|
Advert | |
|
04-06-2009, 05:07 AM | #66 |
Member
Posts: 21
Karma: 112
Join Date: Apr 2009
Device: DR1000S
|
Hi
Thanks for this great tool, it is just what I needed. I have (pre-) ordered an eSlick reader so hopefully it will do some of this since it just uses PDFs. It should work for reflowing my University papers however it won't work (I reckon) for the second reason I am getting an eSlick; my Dungeons and Dragons PDFs. These are all online PDFs now in a landscape format in 3 columns. I have trialled your tool and it works great, although I have to do some manual editing, to get a PDF of just one column... perfect for my eSlick (once again, I hope!). I have one (rather stupid) question when I manually select the areas to crop I have the first page in your program, uuummm how do I then move onto see the second page of the document so I can set the crop on that. Auto segmentation makes too many errors? Oh the only bug I have found is that if you right click in the area of the PDF (like, for example, you are maybe looking for a next page function ) it crashes the programme. I am using XP Pro SP3 all updated etc. Thanks again M1.9P |
04-10-2009, 10:23 AM | #67 | |
Enthusiast
Posts: 27
Karma: 163
Join Date: Nov 2008
Device: Kobo wifi
|
Quote:
Try page up and down keys if that's what you are asking. BTW, currently PaperCrop applies the same areas to all pages you are converting. Thanks, Taesoo. |
|
04-10-2009, 04:59 PM | #68 |
Member
Posts: 21
Karma: 112
Join Date: Apr 2009
Device: DR1000S
|
Thanks I have (now) figured that it applies the same cut to all. Works (mostly) OK for me so still a great tool, often the 'title' page has a picture so being able to go down to the text is great, thanks for your reply
|
05-19-2009, 11:36 AM | #69 |
Rock Chick
Posts: 429
Karma: 4965
Join Date: May 2009
Location: near Heathrow
Device: Kindle 2i, Kindle DX, Kindle 3G
|
This looks great and with my pdf definitely selected things right, but I would actually like to apply the same crop to all pages, I can't seem to find that setting?
|
05-22-2009, 11:43 AM | #70 |
Enthusiast
Posts: 27
Karma: 163
Join Date: Nov 2008
Device: Kobo wifi
|
Suecsi:
Manual segmentation mode applies the same crop to all pages. This might be what you need. |
05-24-2009, 05:59 AM | #71 |
Connoisseur
Posts: 68
Karma: 20
Join Date: Jan 2009
Location: Athens, Greece
Device: Cybook Gen3
|
A very BIG thank you for this piece of software. I was looking for something like that ever since I got my cybook gen 3. Now I can say that I am not in need of any firmware update or whatever because I can now read everything I download from the Internet easily. Thanks again!
|
05-31-2009, 05:08 AM | #72 |
Banned
Posts: 6
Karma: 10
Join Date: May 2009
Device: none
|
thanks, wonderful tool
|
09-13-2009, 09:11 PM | #73 |
Junior Member
Posts: 1
Karma: 10
Join Date: Aug 2009
Device: iLiad v1
|
how to simply cropping a two pages scan into 2
really good tool that i am looking for, but, i can't figure out how to create a script that, simply crop a "two pages scan" into 2 pages in portrait.
can anyone give me some idea? (is there any reference about the script functions of this wonderful tool) |
09-15-2009, 04:10 PM | #74 |
Enthusiast
Posts: 41
Karma: 296
Join Date: Sep 2009
Location: Pacific Northwest
Device: dxg and newfound Icarus 8
|
re 2 page scan
manual segmentation , one image per page ... in other news, papercrop runs under wine .. Slackware 13.0 linux for those non-windows users |
10-13-2009, 07:33 PM | #75 |
Junior Member
Posts: 4
Karma: 10
Join Date: Oct 2009
Device: sony prs 600
|
I used this software. I found it no good for CROP PDF files. Big problem is it made font to become so big. I could read it by my sony prs 600.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Q: multi-column PDF to single column mobi format converstion | auburn1975 | Calibre | 7 | 01-28-2012 07:11 PM |
eBook PDF - free tool for creating PDF eBooks from text files | KACartlidge | 6 | 01-04-2012 10:41 AM | |
Multi column sort? | nexus100 | Calibre | 1 | 07-12-2010 12:19 AM |
Multi-column articles in PDF | tdido | OpenInkpot | 7 | 06-30-2009 12:13 PM |