Tag: split pdf

Split large PDF into multiple small PDFs with workflow engine

In http://blog.aloaha.com/2012/09/13/split-large-pdf-into-multiple-small-pdfs/ we explain how to use the Aloaha API to split large PDF documents into many small documents. In case someone is not able to write or use any scripting language it is possible to use the Aloaha Scripting Engine. Below you find the same sample code implemented as Aloaha Workflow Definition File:

‘define variable for output path
Type=set
ValueName=OutPutPath
Value=c:\pdf\out\
Nextblock=dirblock

[dirblock]
‘enumerate files in input path
Type=dir
Extension=pdf
Directory=%OrgPath%
ResultName=files
Nextblock=CheckLoaded

[CheckLoaded]
‘if enumerated files empty then end – else call com function
Type=condition
Input1=%files%
Input2=”"
TrueBlock=end
FalseBlock=CallCOMFunction

[CallCOMFunction]
Type=com
Object=aloahapdf.edit
Function=SplitAndSave
Parameter=5
Parameter0=%OrgPath%
Parameter1=%OutPutPath%
Parameter2=”Der Rechnungsbetrag wird von Ihrem Konto”
Parameter3=”"
Parameter4=Kunden-Nr.:
ResultName=CallCOMFunctionResult
Nextblock=foreachblock

[foreachblock]
‘loop through original files and delete them
Type=foreach
Nextblock=deletefile
LoopName=DeleteLoop
LoopCSV=%files%
ResultName=LoopTemp

[deletefile]
Type=delfile
DeleteFile=%LoopTemp%
Nextblock=endeachblock

[endeachblock]
Type=endeach
LoopName=DeleteLoop
Nextblock=end


Split large PDF into multiple small PDFs

Some accounting applications are only able to generate one large PDF containing all invoices. If the use needs the invoices as single files there needs to be a mechanism to split them. With the Aloaha SplitAndSave API this is no problem at all.

1. Since every invoice can have a different number of pages any text can be defined as page seperator marking. For example “Kind Regards”
2. A regular expression can be used to extract a string from the PDF to be used as filename. For example “Customer-Number:”

Here a small example on how to use the API:

Dim InputFolder
Dim OutPutFolder
Dim SplitterString
Dim pdf
Dim Letterhead
Dim FileNameRegEx
InputFolder = “c:\pdf”
OutPutFolder = “c:\pdf\out”
SplitterString = “Der Rechnungsbetrag wird von Ihrem Konto”
FileNameRegEx = “Kunden-Nr.:”

set pdf = createobject(“aloahapdf.edit”)
Call pdf.SplitAndSave(cstr(InputFolder), cstr(OutPutFolder), cstr(SplitterString), cstr(Letterhead), cstr(FileNameRegEx))
Set pdf = Nothing

 

In case it is not possible to use a scripting language such as VBS it is possible to use the inbuilt Aloaha Workflow Engine. A sample definition file can be found here:

http://blog.aloaha.com/2012/09/13/split-large-pdf-into-multiple-small-pdfs-with-workflow-engine/

 

Should you have the requirement just to split one file and not X Files in a folder please use the script below. Please note that you need an Enterprise Key. An Evaluation key can be requested at info(at)aloaha.com

 

On Error Resume Next

Dim InputFolder
Dim OutPutFolder
Dim SplitterString
Dim pdf
Dim Letterhead
Dim FileNameRegEx
Dim Pages
Dim SeiteVon
Dim SeiteBis

InputFolder = “c:\pdf\Testkopien.pdf”

OutPutFolder = “c:\pdf\out”

SplitterString = “Rechnungsbetrag Euro”

FileNameRegEx = “([^Kunden-](Nr.:(.[0-9]*)))”

SeiteVon = 10
SeiteBis = 20
set pdf = createobject(“aloahapdf.edit”)
Pages = pdf.PDFDocumentPages( InputFolder)
Wscript.Echo (“seiten ” & Pages)
Call pdf.SplitPDFFile(cstr(InputFolder), cstr(OutPutFolder), cstr(SplitterString), cstr(SeiteVon), cstr(SeiteBis), cstr(FileNameRegEx))

Set pdf = Nothing


Split all PDFs of a given Path into single Page PDFs

User with the Enterprise License can use the Aloaha Scripting APIs as explained on:
http://www.aloaha.com/software-development/pdf-sdk.php

To splitt all multipage PDFs of a given path requires only 3 lines of code:
(http://www.aloaha.com/software-development/freeware-apis.php)

 

Set pdf = CreateObject(“aloahapdf.edit”)

                              Call pdf.split_pdf_in_dir(CStr(“c:\tosplit”))

Set pdf = nothing

 

If you need only to extract some specific pages of a given document you should also try the portable Aloaha PDF Reader:

http://blog.aloaha.com/2012/05/03/aloaha-releases-one-of-the-worlds-smallest-portable-pdf-viewer/

 

 


Aloaha releases one of the worlds smallest portable PDF Viewer!

Aloahas portable PDF Reader has a compressed footprint of just 1,4 MB and as such would fit on a small old Floppy Disk.

The PDF Viewer does not require any installation nor any Admin rights! It can be downloaded HERE or from http://dl.dropbox.com/u/20338532/neverdelete/PDFViewer/AloahaPDFViewer.zip. Just start it from the downloaded zip file!

Please also visit the Aloaha Portable Viewer on www.aloaha.com

Also note that the portable Aloaha PDF Reader is standalone and does not require any installation. Additionally it is also included in Aloahas PDF Suite.

Features: 

  • Multi-Threaded Page rendering – supports modern multi core machines.
  • Works completly in memory so no PDF leftovers in %temp% for extra security.
  • Secure – do not get infected with viruses and keep sensitive information safe.
  • Tiny Footprint – eliminate bloatware and help your computer run faster! No installation required!
  • Decrypts encrypted PDFs. (PDF Password Remover, removes PDF restrictions, password remover) (license required)
  • Opens Images as PDF. (Image2PDF / Image to PDF)
    http://www.aloaha.com/software-development/image-2-pdf.php
  • Copy page as image to clipboard.
  • Copy page as ASCII Text to clipboard. (PDF2TXT / PDF to Text)
    http://www.aloaha.com/software-development/pdf2txt.php
  • OCR for PDF2TXT in case PDF is image based
  • Open RichtText *.rtf directly as PDF! (rtf2pdf)
  • Add RichText directly to PDF (Richtext2PDF / Text2PDF)
  • Open content of clipboard as PDF / convert content of clipboard to PDF.
  • Copy text selection as ASCII Text to clipboard.
  • Read out loud page or selection. (TTS)
  • Save page as HTML. (PDF2HTML / PDF to HTML)
  • Save page as Image. (PDF2Image / PDF to Image)
  • Append PDF Document / insert PDF Document / merge PDF Documents.
    http://www.aloaha.com/software-development/append-pdf.php
  • Append Images to PDF / insert Images into PDF Document. (img 2 pdf)
  • Place images on PDF pages. (Stamp Image on PDF)
  • Extract single page of multipage pdf to a file.
    http://blog.aloaha.com/2012/05/10/split-all-pdfs-of-a-given-path-into-single-page-pdfs/
  • Insert PDF Attachment in Page and adding PDF Attachment to Document.
    http://www.aloaha.com/software-development/pdf-attachments.php
  • Embed PDF in Executable. (PDF2EXE)
  • Multi-Threaded print page/print document.
  • Delete page from PDF without Software installation.
  • Move Page up and Move Page down.
  • Move Page to.
  • Rotate Page left and Rotate Page right.
  • Very fast – read PDF files without waiting and without having to install Software.
  • Incl. PDF Batch Print Processor for instant commandline printing/pdf batch printing.
  • Bookmarking.
  • Command Line Arguments supported
  • Supports Shell Extension Verbs Open and Print.
  • Easy navigation via double click, page up/down, scroll wheel, etc.
  • Keyboard control – all frequently used actions can be done with keyboard only.
  • Easy to use – keyboard shortcuts, intuitive interface, page thumbnail images, …
  • PDF Reader also available as .NET component for your own projects!

All the features above are available as royalty free .NET PDF SDK/Component. Please contact us at info@aloaha.com for further information!

PDF Batch Print Processor:

Just call the PDF Viewer with the “print” option and Aloaha will print the PDF directly to the default printer. For example: c:\> PDFViewer -print “c:\PDF Documents\Invoice1.pdf”
The commercial version will also allow to specify the printer via command line parameter!

Requirements:

  • .NET Framework min. 2.0 required
  • XP, 2003, 2008, 2008r2, Vista, W7 and also W8. All in 32 and 64 Bit mode.
  • Some very few features are disabled in the portable Version. Please install any licensed Aloaha Software to enable all features!

Contact:

Please send feature requests to info@aloaha.com
Aloaha portable PDF Viewer Screenshot

Aloaha portable PDF Viewer

 

Pad File and HTML Pad

 www.aloaha.com


  • RSS Aloaha on Twitter

  • Copyright © 1996-2013 Aloaha Software. All rights reserved.
    RSS Feed
    Powered by WordPress