Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Formats > PDF

Notices

Reply
 
Thread Tools Search this Thread
Old 10-19-2010, 12:19 PM   #16
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Still getting a funky bunch of errors, after which the Terminal hangs and doesn't give back the "$":


usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
rm: : No such file or directory
Reading metadata...
./pdfstretch.sh: line 14: ebook-meta: command not found
./pdfstretch.sh: line 15: ebook-meta: command not found
./pdfstretch.sh: line 16: ebook-meta: command not found
Author(s) recognized as .
Title recognized as .
Language recognized as .

Analyzing page geometry...

./pdfstretch.sh: line 23: : No such file or directory
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
usage: mktemp [-d] [-q] [-t prefix] [-u] template ...
mktemp [-d] [-q] [-u] -t prefix
./pdfstretch.sh: line 26: : No such file or directory
./pdfstretch.sh: line 27: : No such file or directory
cp: fts_open: No such file or directory
kidblue is offline   Reply With Quote
Advert
Old 10-19-2010, 05:21 PM   #17
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Sorry. It's very hard to write software for a platform without the ability to test it on that platform.

But Let's try this one more time.

I guess the mac syntax for mktemp is more different than I thought! I've changed the script so that it doesn't use mktemp at all. The cost of this is that if the script hangs in the middle and you have to manually kill it, it may leave behind some temporary files. You can safely delete them.

I'm still perplexed by ebook-meta. Did you check to see whether or not your version of calibre has it installed? Or what version of calibre you're using? I tried to make the script smart about trying to find it on its own--and hopefully that won't break it!

Similarly, have you tried gs -v from the terminal? What happens? (You did install ghostscript, right?)

Again, I'll swap out the attachment above.

Last edited by frabjous; 10-19-2010 at 05:23 PM.
frabjous is offline   Reply With Quote
Old 10-19-2010, 05:34 PM   #18
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Now it's getting more interesting
First off, I'm running the current Ghostscript, as per your instructions and "gs - v". Calibre got updated today to 7.2.4. From what I can tell, all PDF-related extensions are enabled, but there's a lot of random stuff in there. Not finding pdfmanipulate is totally weird, right? Funny thing is, it's claiming this locate.database issue but I've built that database a few times now.
Thoughts?


ERROR:

home: noah$ ./pdfstretch.sh 3x7=21.pdf
Looking for ebook-meta ...
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.


Could not find ebook-meta calibre subprogram. Skipping metadata steps.

Looking for pdfmanipulate...
WARNING: The locate database (/var/db/locate.database) does not exist.
To create the database, run the following command:

sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist

Please be aware that the database can take some time to generate; once
the database has been created, this message will no longer appear.


Error, Could not find calibre's pdfmanipulate subprogram.
The script cannot work without it.
kidblue is offline   Reply With Quote
Old 10-19-2010, 05:38 PM   #19
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Quote:
Originally Posted by patilsaurabhr View Post
Yes, Windows 7.

The manual of PRS 950SC is of the aspect ratio to fit for the screen. Here is the manual.
They have added the links Contents and Index at bottom 1/5. It's nice to have these links tapped by hand and surfing like web.
Don't you think that when asking a stranger for help online, rather than giving them a PDF and asking them to search for information inside of it, you could just search for the information yourself? Anyway, it looks like the dimensions are 600x1024 pixels, which is a rather strange ratio of 75:128. (This is very close to 3:5, but not quite!) Anyway, it would be trivia to change the script to aim for that instead.

The problem is, the script won't run on Windows. There might be someone who knows how to change a bash script into a Windows/DOS or powershell batch file, but this one is too complicated for me, and I'm not going to install Windows to test on just for this purpose.

If this were really important to you, however, you could install a linux distribution and use that. (If you wanted to keep Windows untouched, you could install linux inside a virtual machine like VirtualBox or something.) But that's pretty extreme, unless you were curious about linux anyway. (Which I do encourage. I'll never go back to the dark days of using Windows.)

Another alternative would be to go back to my original advice and install pdfLaTeX; if you want to try it that way, I can try to help. I have a lot more experience with LaTeX than I do with ghostscript anyway.

Quote:
So , I thought it would be great for 950SC if we could add index of items we like at bottom part of page. Take a textbook as an example. In a chapter, the links below will be for topics in the chapter. And probably we could come up with a program/script that will convert normally bookmarked documents to such types by attachign extended page cut with links as bottom 5th of the page? That would be nice for those users. (Users with long 7" screen)
If you want to discuss something like that, open a different thread. It has nothing to do with squeezing/stretching a PDF.
frabjous is offline   Reply With Quote
Old 10-19-2010, 05:48 PM   #20
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Quote:
First off, I'm running the current Ghostscript, as per your instructions and "gs - v". Calibre got updated today to 7.2.4. From what I can tell, all PDF-related extensions are enabled, but there's a lot of random stuff in there. Not finding pdfmanipulate is totally weird, right? Funny thing is, it's claiming this locate.database issue but I've built that database a few times now.
Thoughts?
The problem seems to be on your end now. There's not much I can do.

Here's what I suggest.
  1. Try creating/updating the locate database with the command it gives. See if that helps.
  2. Try to find ebook-meta and pdfmanipulate yourself using whatever search mechanisms mac offers or just looking around inside whatever directory calibre got installed into.

If you manage to find them, then you can edit the script yourself. Open it in a text editor, and replace the portion:

Code:
echo -n "Looking for ebook-meta ..."
if which "ebook-meta" ; then
    emexec=$(which "ebook-meta")
else
    if locate "ebook-meta" ; then
        emexec=$(locate "ebook-meta" | head -n1)
    else
       echo ""
       echo "Could not find ebook-meta calibre subprogram. Skipping metadata steps."
       emexec="notfound"
    fi
fi
echo ""
with simply:

Code:
emexec="/usr/bin/ebook-meta"
And the portion:

Code:
echo -n "Looking for pdfmanipulate..."
if which "pdfmanipulate" ; then
    pdmexec=$(which "pdfmanipulate")
else
    if locate "pdfmanipulate" ; then
        pdmexec=$(locate "pdfmanipulate" | head -n1)
    else
       echo ""
       echo "Error, Could not find calibre's pdfmanipulate subprogram."
       echo "The script cannot work without it."
       exit 3 
    fi
fi
echo ""
with simply:

Code:
pdmexec="/usr/bin/pdfmanipulate"
But of course change it to the actual paths where you find these things, and not /usr/bin. If they were in /usr/bin, we wouldn't be having this problem.

Last edited by frabjous; 10-19-2010 at 05:51 PM.
frabjous is offline   Reply With Quote
Advert
Old 10-19-2010, 05:56 PM   #21
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Ack! I figured it out. Calibre does not install these tools by default on a mac.

You need to run calibre and go into Preferences->Advanced->Miscellaneous and click "install command line tools".

Source: http://calibre-ebook.com/user_manual/cli/cli-index.html

I guess Kovid is figuring that mac users are too scared of the command line. Prove 'em wrong!
frabjous is offline   Reply With Quote
Old 10-19-2010, 10:57 PM   #22
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Oh, I'm posturing now...

Heads up...

$

Looking for ebook-meta .../usr/bin/ebook-meta

Looking for pdfmanipulate.../usr/bin/pdfmanipulate

Looking for ghostscript.../usr/local/bin/gs

Reading metadata...
Author(s) recognized as Unknown.
Title recognized as 3x7=21.
Language recognized as und.

Analyzing page geometry...

GPL Ghostscript 8.71 (2010-02-10)
Copyright (C) 2010 Artifex Software, Inc. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 103.
Page 1
Page 2
Page 3
Page 4
kidblue is offline   Reply With Quote
Old 10-19-2010, 11:07 PM   #23
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Oh my...

Page 102
Page 103

Now cropping the pages... done.

Reinstating metadata...

Original metadata::
Title : 3x7=21-stretched
Author(s) : Unknown
Language : und

Changed metadata::
Title : 3x7=21-stretched
Author(s) : Unknown
Language : und

Finished. Output saved as 3x7=21-stretched.pdf.
kidblue is offline   Reply With Quote
Old 10-19-2010, 11:13 PM   #24
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Looks great - I need to charge my Kindle (I leave wifi/3G on, so it only lasts a few days) to get it delivered and see it on the screen...

The auto-crop kind of puts Briss to shame, as awesome as Briss is. For my purposes, just seeing the text and now squeezed into the right aspect, I'm really confident this could make a huge difference for a lot of PDF readers, and a big population of folks who want to read text-based PDFs like screenplays. You're all the way across the country, but next time you're in L.A., I'm buying you a beer.

Now comes the major question: What is the process of turning this into an executable application outside of the Shell? I know that's something that's built-in with Applescript/Automator (obviously Mac-centric), but I've never messed with it. Maybe that's a weekend project to learn...

UPDATE:

So here's something interesting; Because the script crops not to a set margin, but to the widest point the text hits, most pages are slightly different in width. What we end up with is a stretched full-page but somehow, the Kindle is still attaching margins. See attached.

Why are there still margins? The point of squeezing was to get the text tight enough to fill the page, right?

The next experiment is going to be cropping the pages in half as per Briss (it's back in action, I shouldn't have opened my big mouth!) and then running the script, to see if it evokes the right aspect but on a smaller page.

Is there a way to adjust the script to actually output "Kindle-sized" (as opposed to aspect-ratio) pages? Would that make a difference?
Attached Thumbnails
Click image for larger version

Name:	P1040159.jpg
Views:	176
Size:	121.1 KB
ID:	59969  

Last edited by kidblue; 10-19-2010 at 11:44 PM.
kidblue is offline   Reply With Quote
Old 10-20-2010, 02:33 AM   #25
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
The issue there is that it scales/distorts the pages by a fixed percentage, and that fixed percentage is based on what it needs to scale the wider pages by in order to get them to 3:4. So pages that aren't as wide aren't stretched all the way to 3:4; the aspect ratio of the page is therefore less than 3:4, and the Kindle has no choice but to leave gaps on the sides. (There's not margins, since they're "off the page", but the effect is the same.)

I actually had it work that way deliberately, because I thought it would be jarring if some pages were stretched in a much different way or amount than others. Consider, for example, the last page of a chapter. If there were only two lines on the page, it would make each character 2 or 3 inches tall without changing its width!

But I guess you could try it if you really want. It would mean changing the script so that it processed each page one at a time rather than all of them as a group. I don't have time to work more on it today, but maybe sometime in the next few days.

P.S. About turning it into a program that ran outside of a shell... well, it's all automated, so there would be no point to having a GUI except a big button that said "Go!" or something like that. Could you make a GUI with a single button, which when the button was clicked, ran this script? I'm sure it's possible. I would know how to do it for Windows and linux, but I know nothing about such things for a mac. If you sat me in front of a mac, I'm not even sure I'd be able to find the File Manager or "Finder" or whatever it is called. All I really know about OS X is that it's Unix-based underneath and can run Bash.

But what I would suggest is something like an "Context Menu" option associated with PDFs that would run the script on them. (By "context menu" I mean the menu you get in your File Manager when you right click (or hold the mouse button down or whatever you do with those funny 1-button mice macs sometimes have).) For all intents and purposes, the script is a program, and the File Manager probably already has a way of adding "Open With..." options to the context menu, and you'd just need to add this script as an Open With option. But don't ask me how to do that on a mac. I don't have any clue.

Last edited by frabjous; 10-20-2010 at 02:45 AM.
frabjous is offline   Reply With Quote
Old 10-20-2010, 10:51 AM   #26
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
It occurred to that one way to get what you want (or what I think you want) is to simply burst the PDF into separate pages, in effect run the old script on each page, and them reassemble them, and so making the changes to the script are actually fairly simple.

So here's a new script you can try if you want.

I also made some other minor changes, mainly suppressing some of the terminal noise ghostscript makes (--which may end up suppressing error messages, but I'm not sure they'd be meaningful to you anyway--), and forcing each page into the exact Kindle page size. (Well, 3.54 × 4.72 inches, which is 90x120 rounded off the nearest 100th of an inch.)

One disadvantage, in addition to some strangely skewed pages, is that the script is a lot slower. I already thought the script was slow compared to BRISS, and compared to sopdf, it's a dead snail. This is in part because it does each page separately, and also in part because of the variation in stretching, it takes it longer to figure out how to crop the page.

I've giving this script a different name, and posting it separately, rather than replacing the one above, since some people might prefer to use the one above instead. They both have their advantages, I suppose.

This one is called pdf3to4.sh (to mark that all pages have a 3:4 ratio). The instructions for using it are the same. Download the tarball, extract the file pdf3to4.sh, and then:
Code:
cd "/path/where/you/saved/it"
chmod a+x pdf3to4.sh
./pdf3to4.sh "example.pdf"
You only need to do the middle thing the first time you use it.
Attached Files
File Type: gz pdf3to4.tar.gz (1.8 KB, 85 views)

Last edited by frabjous; 10-20-2010 at 07:26 PM.
frabjous is offline   Reply With Quote
Old 10-20-2010, 11:57 AM   #27
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Thanks for this new script, but no dice on it. See the "spoiler" below.

You make some awesome points. I completely agree that a contextual menu would be the way to go, even a shortcut that could be applied to a selected folder or file. Heck, that'd be the way to go with Briss, too, for that matter. From a GUI perspective, that would be the most efficient. I imagine there's an easy way to convert a Bash file to Applescript for it, and that'll be a little fun research for me, getting my feet wet. And we Mac users haven't had one-button mice for a few years

I think this is the issue with the concept overall - In dealing with a PDF, the Kindle (and I imagine most readers of the ilk) will expand the text of a given page as far as the margins or "dead" space will allow. In other words, if dealing with a screenplay and center-justified "dialogue" text with no left-justified descriptive text, it will expand the size of that text greatly and on the next page, if there is left-justified text, go back to a smaller size.

What I propose is this (and it may be in the new script, I just haven't seen it yet): A formatting that cuts down on the margins (auto-crop) and confirms that each page is exactly the same size (as per Kindle) as opposed to the same aspect ratio. Because the reader will simply stretch and/or squeeze the page "to fit", we need to "trick" it into seeing each page as exactly the same size. In this case, it's something that PDfs are actually useful for! I think that's exactly what you did

This is interesting in that it still doesn't quite take the place of what Briss does, although I'd like it to. Looking at the average screenplay document, each page, without the margins or dead-space is only 15x20 cm. Comparing that to a Kindle screen (9x12 cm), we're only talking about approximately a 30% reduction, which should be still totally readable. If we could factor in what Briss does and split it vertically, we should be able to end up with a consistently-sized document that is readable, with a "constant" in the size of each page, don't you think?

Error:
(my shell is "noah" and the PDF is "3x7=21.pdf")

Spoiler:
homedf3to4 noah$ ./pdf3to4.sh 3x7=21.pdf
Looking for ebook-meta .../usr/bin/ebook-meta

Looking for pdfmanipulate.../usr/bin/pdfmanipulate

Looking for ghostscript.../usr/local/bin/gs
Creating temporary folder...Delete the temporary folder if the script fails!

Reading metadata...
Author(s) recognized as Unknown.
Title recognized as 3x7=21.
Language recognized as und.

Splitting pages..../pdf3to4.sh: line 135: seq: command not found
done.

./pdf3to4.sh: line 135: seq: command not found

****** ****** ******
Now re-merging the various pages..../pdf3to4.sh: line 116: seq: command not found
Error: Two or more PDF files are required.

Usage:
pdfmanipulate merge [options] file1.pdf file2.pdf ...

Metadata will be used from the first PDF specified.

Merges individual PDFs.


Whenever you pass arguments to pdfmanipulate that have spaces in them, enclose the arguments in quotation marks.

Options:
--version show program's version number and exit

-h, --help show this help message and exit


Merge Options::
Options to control the transformation of pdf

-o OUTPUT, --output=OUTPUT
Path to output file. By default a file is created in
the current directory.


Created by Kovid Goyal <kovid@kovidgoyal.net>

done.

Reinstating metadata...Python function terminated unexpectedly: (2, 'No such file or directory')
Traceback (most recent call last):
File "/Applications/calibre.app/Contents/Resources/Python/lib/python2.6/site.py", line 147, in main
return run_entry_point()
File "/Applications/calibre.app/Contents/Resources/Python/lib/python2.6/site.py", line 116, in run_entry_point
return getattr(pmod, func)()
File "site-packages/calibre/ebooks/metadata/cli.py", line 156, in main
IOError: [Errno 2] No such file or directory: u'output.pdf'
done.

Cleaning up...mv: rename tmppdf3to4dirkk/output.pdf to 3x7=21-stretched.pdf: No such file or directory
done.
Finished. Output saved as 3x7=21-stretched.pdf.
kidblue is offline   Reply With Quote
Old 10-20-2010, 02:45 PM   #28
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
macs don't have seq? wtf? How can it be unix and not have seq? ("JOBS!" I scream in a Kirk-hating-Khan-voice.)

Anyway, I've swapped out the script in post #26 with one that doesn't use seq. I also tried to make a minor speed improvement, but I doubt it will matter much.

I'm not actually sure the chmod step is even necessary, but it may depend on your tar.gz archive extraction program. It won't hurt though you might as well keep doing it.

So now we can see how this one breaks.

P.S. Of course this doesn't replace BRISS. If nothing else, this script is incapable of removing headers and footers, which BRISS is. BRISS is also more useful for scanned PDFs and multicolumn PDFs and a lot more. I love BRISS and use it a lot.

P.P.S. I know nothing about Applescript, but I imagine the way to go would be to call the bash script from the Applescript, rather than trying to convert the one to the other... just use one inside the other, so to speak.

Last edited by frabjous; 10-20-2010 at 02:56 PM.
frabjous is offline   Reply With Quote
Old 10-20-2010, 07:03 PM   #29
kidblue
Connoisseur
kidblue began at the beginning.
 
Posts: 79
Karma: 10
Join Date: Oct 2010
Device: Kindle 3
Now we're cooking with gas. This was exactly what I was looking for; A way to "crop-and-zoom", fit the PDF pages to the screen at the largest possible type in a full page!
Seriously, it is amazing to see this kind of help from a fellow forum-member. Thanks don't begin to describe it.

I'm looking into Applescript right now. It's easy enough to basically create a script that calls up yours and sticks it in a Finder's contextual menu, but it's going to require a bit of research to allow it to "do its thing" from another folder other than the one it resides in, if that makes sense.

It has been leaving "tmppdf3to4dirkk" with various PDF files (each page's "crop", "out" and "skew") - Should it be doing that or should it automatically be trashing that folder of what's obviously temporary files when done with the conversion?

I also love and appreciate BRISS, but in the case of what you've done here, by scaling (if that's the correct term) is almost make the headers and footers inconsequential, whether they are they or not. Obviously, I don't see them on the screen since they stay fit to the widest margin set by the actual type.

Again, sincere thanks.
kidblue is offline   Reply With Quote
Old 10-20-2010, 07:24 PM   #30
frabjous
Wizard
frabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameterfrabjous can solve quadratic equations while standing on his or her head reciting poetry in iambic pentameter
 
frabjous's Avatar
 
Posts: 1,213
Karma: 12890
Join Date: Feb 2009
Location: Amherst, Massachusetts, USA
Device: Sony PRS-505
Quote:
Originally Posted by kidblue View Post
Seriously, it is amazing to see this kind of help from a fellow forum-member. Thanks don't begin to describe it.
No problem. This is my perverse idea of fun. And if you learned something, I learned more. Besides, my Sony 505 screen happens to have the same dimensions as your Kindle screen, so I can use the script too.

Quote:
It has been leaving "tmppdf3to4dirkk" with various PDF files (each page's "crop", "out" and "skew") - Should it be doing that or should it automatically be trashing that folder of what's obviously temporary files when done with the conversion?
D'Oh. No, you can definitely delete that folder. In fact, you should, or it might mess up future runs.

I commented out the line that is responsible for deleting the temporary folder when I was testing the script (so I could see where things went wrong when they did), but then I forgot to restore the line. I'll put an update to the script above, and you can download that if you want. Or if you prefer, you can edit the script directly in a text editor. You just need to change line 136 (about 8 lines from the bottom of the file) from:

Code:
# rm -rf "$wd"
to

Code:
rm -rf "$wd"
(I.e., removing the "#".) Of course, if mktemp had worked properly on mac, this wouldn't be an issue...

Oh, and don't name any folders you want to keep "tmppdf3to4dirkk", no matter how cool it seems, or they'll get gobbled.
frabjous is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing a PDF file to custom margins ? masa6614 General Discussions 0 06-08-2010 05:21 PM
Changing DPI in a PDF ardeegee PDF 3 02-18-2010 02:39 PM
Changing font size in pdf mrgiedrnkr Amazon Kindle 1 12-01-2009 06:33 PM
Changing pdf properties Puddytat purr PDF 2 02-22-2008 10:27 AM
pdf page changing speed ? bugsbunny14 Sony Reader 15 10-19-2006 06:28 PM


All times are GMT -4. The time now is 06:04 PM.


MobileRead.com is a privately owned, operated and funded community.