WatchDirectory home page
WatchDirectory Startseite (Deutsche Version)
Site WatchDirectory (Français)
  Welcome, Guest. Please Login or Register
YaBB - Yet another Bulletin Board
   
  HomeHelpSearchLoginRegister  
 
Page Index Toggle Pages: 1
Automated TIFF/PDF files processing (reduce page#) (Read 5738 times)
Chrisq
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Automated TIFF/PDF files processing (reduce page#)
Oct 5th, 2005 at 1:58am
 
All,

I'm looking for a way to automatically split all of my large TIFF and PDF files into 20-page ones. For example, for a 200-page PDF file call test.pdf, a folder called test will be created and the file will be splited into ten 20-page PDF files (inside the folder). I would like to do this for the entire directory tree. I plan to use WatchDirectory to monitor and process new files.

Is there any tools to do the above TIFF/PDF processing for watchDirectory?

TIA.

Chris
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Automated TIFF/PDF files processing (reduce pa
Reply #1 - Oct 5th, 2005 at 7:26am
 
Hello Chris,

I never used it, but perhaps "pdfpg" can help:
http://www.verypdf.com/pdfpg/

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Chrisq
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Re: Automated TIFF/PDF files processing (reduce pa
Reply #2 - Oct 6th, 2005 at 12:30am
 
Gert,

Thank you. http://www.verypdf.com/pdfpg/ can process the PDF file with commandline option (so I assume WD can work with it). I do have a software called Omniformat to convert TIFF to PDF and back to TIFF (so that PDFPG can process it). It also support command line.

I hope I do not push WD too much with the processing below. Is it possible to,

1) use WD to watch a folder and its subfolder for new, changed or delete TIFF and PDF files. It won't care about any other file types.

2) If the new or changed files is PDF, WD will tell PDFPG to splite it into n-page PDF files inside a newly created subfolder with the same name.

If the file name is test12345.pdf, WD will create a subfolder test12345 and dump the n-page PDF files into it.

3) If any PDF files are deleted, WD will also delete its subfolder (if any).

4) If the new or changed file is TIFF, WD will first tell Omniformat to convert it to PDF file (so that PDFPG can work on it).

Then, WD will do step 2) just like for any PDF files.

5) After the n-page PDF processing is done, WD will tell Omniformat to convert the PDF files (and its newly created n-page PDF files inside the subfolder) back to TIFF format.

This time, WD must not convert it to PDF again to prevent looping.

6) If a TIFF file is deleted, a subfolder with the same name will also be deleted. For example, If the file name is test12345.tif and there is a subfolder call test12345 on the same folder level, the folder will also be deleted.

The file name is guaranteed to be unique for each folders inside the directory tree. There will never be files with the name like test1235.pdf and test12345.tif on the same folder. The name before the . is always unique in a folder.

TIA.

Chris
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Automated TIFF/PDF files processing (reduce pa
Reply #3 - Oct 6th, 2005 at 6:12pm
 
It's all possible, but I need some more info. It would be best to use several "work directories" and multiple tasks to handle this.
So, if your original directory is C:\Hot, let one task monitor it for new PDF files (see http://www.watchdirectory.net/wdhelp/help/wdnewconfigpage2.html how you can limit to PDF only), use the "auto copy" plugin (http://www.watchdirectory.net/wdhelp/plugins/wdopAutoCopy.html) to copy those new PDF's to C:\SplitThem.

Another task would also watch C:\Hot, but now for TIF files. Those are auto-copied to C:\ConvertToPdf.

Another task would monitor C:\SplitThem and use pdfpg to split the PDF's to the desired (final) directory (take care that this directory is not monitored for new PDFs).

Another task would monitor C:\ConvertToPdf and use your omniconvert to create a PDF inside C:\SplitThem.

A final task would monitor for deleted PDF and TIF files and run a .bat that checks to see if a corresponding directory with "split pdf's" exists, and deletes that directory.

Hope that helps,
Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Chrisq
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Re: Automated TIFF/PDF files processing (reduce pa
Reply #4 - Oct 7th, 2005 at 8:59am
 
Gert,

The ideas sound good. However, the problem is that I need to make sure the splited PDF and TIFF files are in the exact same location as the originals. The c:\hot is a large folder tree.

If the 100-page test12345.PDF is located at c:\hot\folder1\, all of the splited 20-page PDF files should be in c:\hot\folder1\test12345\ folder.

If the 100-page test54321.TIF is in c:\hot\folder2\, all of the splited TIFF files will be in c:\hot\test54321\ folder.

How do I make sure the destination for C:\SplitThem will be where it should be?

Thanks again.

Chris

Back to top
 
 
IP Logged
 
Chrisq
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Re: Automated TIFF/PDF files processing (reduce pa
Reply #5 - Oct 7th, 2005 at 9:06am
 
Gert,

How would you handle NTFS File/Folder Permission? Does the Copy Plug-in copy the NTFS security attribute?

Chris
Back to top
 
 
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Automated TIFF/PDF files processing (reduce pa
Reply #6 - Oct 7th, 2005 at 9:19am
 
Nope, they are not copied, looking at the documentation for the Win32 function CopyFileEx (that is used by the plugin, see http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/copyf...):
Quote:
This function preserves extended attributes, OLE structured storage, NTFS file system alternate data streams, and file attributes. Security attributes for the existing file are not copied to the new file. To copy security attributes, use the SHFileOperation function.


Good point, I'll see if I can change the plugin to use the SHFileOperation function instead. However, that will need some testing as SH*-functions often don't run reliable inside Windows Service applications.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Automated TIFF/PDF files processing (reduce pa
Reply #7 - Oct 7th, 2005 at 10:50am
 
Quote:
If the 100-page test12345.PDF is located at c:\hot\folder1\, all of the splited 20-page PDF files should be in c:\hot\folder1\test12345\ folder.


Okay, in that case you should not use the AutoCopy plugin, but always a .bat file.
Inside the .bat you should first check if the event is for a generated pdf file (we don't want to split them again). I think the easiest way would be to check if the pdf is located inside a folder with the same name as itself...
Or, perhaps the splitted PDF files all have something common in their name, for example an underscore to separate the "original name" from the page-number part.
In that case the beginning of your .bat file would be something like:

Code:
rem if not PDF or TIF, ignore it
IF "%WD_FILE_E%" EQU "PDF" GOTO :ContinueProcPdf
IF "%WD_FILE_E%" EQU "TIF" GOTO :ContinueProcTif
GOTO :EOF

:ContinueProcTif
... convert to PDF ....

... and fall through here ...
:ContinueProcPdf
rem if the file has an underscore in its name, ignore this event
"%WD_INSTDIR%\GdPUtil.exe" -matches "%WD_FILE_B% "*_*"
IF %errorlevel% == 1 GOTO :EOF

rem create the new subdirectory:
MD "%WD_FILE_D%%WD_FILE_B%"

... use pdfpg here ...

rem if the original was TIF, delete the converted PDF here
IF "%WD_FILE_E%" == "TIF" (
  DEL "%WD_FILE_D%%WD_FILE_B%.PDF"
)
 



Does that help?
Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Gert
YaBB Administrator
*****
Offline



Posts: 2239
The Netherlands
Re: Automated TIFF/PDF files processing (reduce pa
Reply #8 - Oct 9th, 2005 at 11:08am
 
Quote:
Gert,

How would you handle NTFS File/Folder Permission? Does the Copy Plug-in copy the NTFS security attribute?

Chris


The 4.0.36 release uses the SHFileOperation method of copying files, so NTFS security attributes will be copied.

Gert
Back to top
 

Gert Rijs - gert (at) gdpsoftware (dot) com
Blog: http://blog-en.gdpsoftware.com/
End Alzheimer's: http://www.alz.org&&...
WWW WWW GdPSoftware  
IP Logged
 
Page Index Toggle Pages: 1