Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 27 Aug 2014, 10:59
All times are UTC - 4
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
joinPdf
Moderators: deshlab, Flash, GuestToo, Ian, JohnMurga, Lobster
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [29 Posts]   Goto page: Previous 1, 2
Author Message
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 01 Nov 2007, 00:36    Post subject:  

That's the one.

OK. I just updated the script. Changes:
-A bit extra in the help windows
-Quoted the ROX command - the script now fully works with spaces in the path/name of the output file
-Changed the defaults so they are set to the working directory. (I really was silly - I was using /temp instead of /tmp Smile)
-Changed the file selector for the output file to accept folders instead of files, so you can choose an empty directory, but you have to manually add the file name, so you can't just click on an existing file.

I'll just go and remove that "apology dialog". It is a leftover from an earlier stage of the design process.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 01 Nov 2007, 03:30    Post subject:  

OK, I sorted out the output file selection - that works great now.
If I can only get spaces in the input files to work...
Back to top
View user's profile Send private message 
john biles


Joined: 17 Sep 2006
Posts: 1407
Location: Australia

PostPosted: Thu 01 Nov 2007, 09:57    Post subject:  

Hello disciple,
Just letting you know that I will be including joinPDF in the Bugfix / Update of TEENpup 2.14.1 which will be released soon. Very Happy

_________________
Legacy OS 2.1 LTS Released! Install me on a new! EXT2 Partition with 500Mb of swap and I'll be happy. Razz
Legacy OS 4 Released! Install to newer legacy hardware / early EeePC's Very Happy
Back to top
View user's profile Send private message Visit poster's website 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 01 Nov 2007, 16:53    Post subject:  

Sweet - hopefully some people will find it useful.

I've given up on trying to get it to work with spaces in the input files, as I can't figure out why gs can handle quoted inputs manually typed at the command line, but not from a script Sad
Back to top
View user's profile Send private message 
vovchik


Joined: 23 Oct 2006
Posts: 1285
Location: Ukraine

PostPosted: Thu 01 Nov 2007, 18:05    Post subject: spaces in filenames  

Dear disciple,

I know this is a crude suggestion, but you could use a routine like the one below, but rather than using "mv" as in the attached script, replace it with "ln" to create symlinks in a temporary dir. You could then pass the symlinks to gs and remove them and the tmp dir after processing the pdfs. It's not a particularly elegant solution, I admit, but I think it just might do the trick.

I do find your program useful as I compose music and output scores to pdf files (for the moment, using Windows in a virtual machine). The parts - sometimes over 25 separate files for various instruments - also have to be included at the end of the main pdf (conductor's score) to simplify printing and emailing. JoinPdf does exactly what I need for that operation, so thanks.

With kind regards,
vovchik

Code:
#!/bin/bash
IFS='
'
j=`find $1 -printf "%d\n" | sort -u | tail -n 1`
j=$((j-1))
echo "Max dir depth:" $j
for (( i=0; i<=j ; i++ ))
do
for name in `find -mindepth $i -maxdepth $i -iname "* *" -printf "%p\n"`
do
newname=`echo "$name" | tr " " "_"`
echo "$name" "$newname"
mv "$name" "$newname"
done
done
##########
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 01 Nov 2007, 20:22    Post subject:  

Quote:
I do find your program useful
That's nice to know.

I had thought of doing what you suggest, I was just waiting a while in case someone else had a look and figured out how to do it properly Smile
It should be possible to do - I can do a script with the specific filenames in it, and that works, so I think I don't quite understand what's happening when I try to replace newlines from the sort output with spaces.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Sat 08 Dec 2007, 19:26    Post subject:  

muggins thinks this approach might help deal with spaces in the name/path. It is too complicated for me, but someone else maybe able to do something with it Smile
Back to top
View user's profile Send private message 
muggins

Joined: 20 Jan 2006
Posts: 6681
Location: lisbon

PostPosted: Sat 08 Dec 2007, 19:51    Post subject:  

Sorry Disciple,

I should have clarified. The only bit that deals with filenames containing spaces could be summarised as:

Code:

......whatever pre-processing is done here......

for file in $directory/*
do
   if [ -d "$file" ]; then #To identify if it's a directory
      cd "$file"         #If so change to that directory
          scriptname  #The script is calling itself recursively to process the directory
          cd ..            #Then when finished, go back up one directory
     else
      filename=${file%.pdf}    #This bit deals with spaces in filename     
      xxx "$filename.pdf"  #This is whatever processing your script does
     fi
done


I hope that's a bit clearer. All the rest of that other script was just to do with whether the user passed any arguments to the script, and to identify .pdf files from other files.
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Sat 08 Dec 2007, 20:27    Post subject:  

Yes, but I couldn't figure out how to integrate that with the recursive approach of my script Sad
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Mon 25 Aug 2008, 06:34    Post subject:  
Subject description: OK, I have the solution, now I just need the time to figure out the necessary code
 

We can create a temporary folder somewhere, and as we find each pdf, symlink it into that folder, with a name that is the current count, and then we join like this:
~# gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile="/ouput path/output file.pdf" ~/.joinpdf/*.pdf
I checked, and gs does join files with an *, so now we just need to figure out how to create all those symlinks. I figure no one will be joining more than 100 files, so we can start at 01. Or I guess to be really sure we could do 001, 002, 003...
Or maybe it would be easier to start at 100 so we don't have to figure out a way to prefix the zeros. So we just somehow get a count and add 100.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Sat 30 Aug 2008, 03:08    Post subject: Updated joinPdf
Subject description: gui to combine Pdf files
 

OK, fixed. New version in the first post.
Thanks Pizzasgood for the help.

_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 06 Aug 2009, 04:17    Post subject:  

You might also like to try pdfshuffler.
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
disciple

Joined: 20 May 2006
Posts: 6428
Location: Auckland, New Zealand

PostPosted: Thu 27 Aug 2009, 05:28    Post subject:  

I've made an 11MB .sfs to make it easy to install pdfshuffler and its dependencies - python, pygtk etc. http://www.murga-linux.com/puppy/viewtopic.php?t=45826
_________________
DEATH TO SPREADSHEETS
- - -
Classic Puppy quotes
- - -
Beware the demented serfers!
Back to top
View user's profile Send private message 
MikeyBrat

Joined: 30 Dec 2012
Posts: 20

PostPosted: Fri 16 Aug 2013, 18:21    Post subject:  JoinPDF
Subject description: PDF joiner
 

Works great!
Thanks.

-
Puppy Precise 5.6.1 frugal usb (among other puppies)
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 2 of 2 [29 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Advanced Topics » Additional Software (PETs, n' stuff) » Unsorted
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0793s ][ Queries: 13 (0.0110s) ][ GZIP on ]