File Compression

I have a web service created in a .net environment that examines existing pdf files in a staging directory prior to sending them over the wire using FTP.
Part of that process requires that I rename individual files in order to associate them with a particular batch.
I also have a requirement to reduce the size of individual files as much as possible in order to reduce the traffic going over the line.
So far I have managed about a 30% compression rate by using an open source library (iTextSharp).
I  am hoping that I can get a better compression rate using the Acrobat SDK, but I need someone to show me how, hopefully with an example that I can follow.
The following code snippet is a model I wrote that accomplishes the rename and file compression...
            const string filePrefix = "19512-";
            string[] fileArray = Directory.GetFiles(@"c:\temp");
            foreach (var pdffile in fileArray) {
                string[] filePath = pdffile.Split('\\');
                var newFile = filePath[0] + '\\' + filePath[1] + '\\' + filePrefix + filePath[2];                
                var reader = new PdfReader(pdffile);
                var stamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Create), PdfWriter.VERSION_1_5);
                int pageNum = 1;
                for (int i = 1; i <= pageNum; i++) {
                    reader.SetPageContent(i, reader.GetPageContent(i), PdfStream.BEST_COMPRESSION);
                stamper.Writer.CompressionLevel = PdfStream.BEST_COMPRESSION;
                stamper.FormFlattening = true;
                stamper.SetFullCompression();
                stamper.Close();
Any assistance is appreciated.
regards,
Greymajek

Greymajek wrote:
...using the Acrobat SDK...
Then you better ask in the Acrobat SDK forum.

Similar Messages

  • Does Time Machine use a differential/delta file compression when copying files ?

    Hello,
    I would like to use Time Machine to backup to a MacBook Air but that computer is using a Virtual Machines store in a single file of 50 GBytes.
    Once the initial backup will be done, does Time Machine will only copy the changes in this large file or will everyday copy the full 50 Bytes?
    In other word does Time Machine use a differential/dela file compression algorithm (like un rsync)?
    If it is not yet the case, can you please file for me an application request to the development team internally?
    If others are also interested in such a feature, you’re welcome to vote for it.
    Kind regards,
    Olivier

    Ok, it looks like the current version of Time Machine cannot handle efficiently in network terms large files like Virtual Machine files and this a real issue today.
    Is anybody here able to file an official feature request to Apple to be able to use Time Machine efficiently also with large files (let's stay > 5 GBytes) ?
    I should propably mean using a differential compression algorythm over the network like the examples below:
    http://rsync.samba.org/tech_report/tech_report.html
    http://en.wikipedia.org/wiki/Remote_Differential_Compression

  • Applescript:: PICT File Compression doesn't work [?]

    I have tried many options for getting Pict file compression to work via scripting but to no avail. Can anyone confirm if this works in PS CS4?
    PICT file options I am trying to get to work are:  {class:PICT file save options, compression:maximum quality JPEG, embed color profile:false, resolution:thirty two, save alpha channels:false}
    All option **except compression seem to work.. :/
    Example code:
    set newPictFilePath to ((path to desktop folder) & "newPictFile.pct") as string
    tell application "Adobe Photoshop CS4"
    set docRef to current document
    set photoshopSaveFormat to PICT file
    set photoshopSaveOptions to {class:PICT file save options, compression:maximum quality JPEG, embed color profile:false, resolution:thirty two, save alpha channels:false}
    set kSavedDocument to save docRef in file newPictFilePath as photoshopSaveFormat with options photoshopSaveOptions appending no extension with copying
    end tell

    Hello,
    I did not have any problems with the script you posted, but I ran into issues when my document was not flattened, or was not RGB. After I added that to the script, everything seemed to work.
    I also have a habit of telling a document to save instead telling the app to save a document, but that might just be my quirk.

  • File Compression Error Occurred on Expert Settings

    I finally thought I had a decent set of settings to compress the QT movie for YouTube (and will tweak this now that each ten minute movie can be 1 gig! Hooray!). So I used what had worked on the previous movies and got the error
    File Compression Error Occurred
    The movie could not be properly compressed. The movie may contain some data that is invalid for the type of compression selected.
    The movie itself contains imported footage from my camcorder (DV), as I usually use. And I used only iMovie stock music loops and one Sfx...all aif files.
    I've tried tweaking the settings of Expert Settings here and there. Changed the 15 fps to 30. Made the Key At this point, what do I look at? Something within the movie itself? Or the settings (H.264, qual. Hi but also tried med, Frame rate tried 15 and 30, Key frame rate tried Auto and 10, Encoding multi-pass, Dimen. 640x480, Scale Letterbox. Sound is ACC, 24,000 kHz, stereo, bit rate 48kbps. Prepare for internet streaming is unchecked currently. Think it was that way when I last made a movie.
    Don't know where to continue to troubleshoot this. URmpfff. Help!

    Wow...this is a sticky problem. I could not resave the movie as another name. Frozen program, pinwheel of death, etc. I've had about three frozen attempts since I first wrote...
    Googling phrase from error message got only a few lost souls who never did post the solution. One solution someone had figured the problem was with Flip4Mac...to uninstall it, but they had problems uninstalling it. So did it...frozen computer).
    I did get this solution to work to move my movie along. It saved rather quickly to a 350 meg or so full quality file on Expert settings. Then got a single .dv file. Imported that into a new iMovie project (wonderful....that I titled My Great Movie fer petes sake...Hope I remember to retitle it.
    Along the way were error messages like Error 54, no permission to write to file, no hard drive space, etc. Baloney, I think...or is there any clue in all this?
    Thanks.

  • JPEG File Compression

    I just found out that when raw files are converted (via the export function) to jpeg, the file compression is extremely low. MY posted online picture quality certainly reflects the low jpeg file size.
    When I export pictures, I get several choices, but none of the choices allows me to set the jpeg compression to a "high" level.
    Can someone help me maximize my converted jpeg file size. I shot with a 21 megapixel camera and end up with a 1mb file (not good)

    Thank you Ian ... I appreciate your quick reply. It seems that after I upgraded my camera from a Canon xti to a Canon 5D Mark II and from a PC to an iMac, I find that I am very ignorant of photography and post processing.
    The combination of equipment above with Aperture is causing me huge problems since I can not get the picture quality (on screen or prints) that I got from the xti and pc. My pictures were post card quality - the upgraded equipment combination is giving me poor quality photo's. Very frustrating. I wonder where I can go for help ?

  • File Compression Problem

    Hello all,
    I'm having a strange file compression problem with CS5 on our new Mac Pro.  We purchased the Mac Pro to scan and process images, but the JPEGs and GIFs we create from this computer are much larger than they should be when closed (e.g. images that should be compressed to 6KB are reading as 60KB, and the file size is often smaller when opened than closed). Furthermore, anytime we use these image files in other programs (e.g. Filemaker Pro) the inflated file size will carry over.  What's even more puzzling is that the same files that are reading as 60KB on our Mac Pro will read correctly as 6KB from a PC.  Similarly, if we embed these images -- that were created on the Mac Pro -- into Filemaker from a PC, the image file size is correct.  We cannot use the compressed files we create on our Mac Pro because the inflated file size will be passed on to whatever application we use on the Mac Pro (except for Photoshop).
    We have been processing images for years on a PC and haven't had any troubles with this.   We were thinking for a while that the problem was with the Mac operating system, but after many calls with expert Apple advisers it seems like Photoshop for Mac has to be the issue.  We have already tried reformatting and re-indexing the hard drive, and at this point there is nothing else that can be done from Apple's end.  The last expert I spoke with at Apple said that it sounds like the way Photoshop for Mac compresses files and how Mac reads file sizes is very different from the way Photoshop for PC compresses files and how Windows reads file sizes.  If he was correct, and there is no work-around, we'll have no other choice and will have to return our Mac.
    Has anyone else experienced this before?  The experts at Apple were thoroughly confused by the problem and so are we.
    Thanks,
    Jenny

    This has nothing to do with compression.
    Macintosh saves more metadata, and more previews than Windows - that's one part.
    Macintosh shows the size of the file on disk, including wasted space due to the disk block size - that's another part. (look at the byte count, not the size in K or MB).
    When you upload the files to a server, or use them in most programs, that extra metadata is lost and the file sizes should be identical.
    I can't believe that your advisors spent any time on such a trivial issue...

  • File compression question

    Question about using the file compression feature within Finder. I understand that when I select multiple files and compress them, it creates a ZIP file with the default name 'archive.zip.' I created a working folder on my desktop and put in about 16 alias of photos that are down in my iPhoto 'originals' folder. When I created the archive.zip, file it was only 2.1 MB (the jpg's varied in size from <1 MB to 3 MB).
    I did this with the presumption that by using aliases in my working folder, the compression utility actually compressed the jpg's in the various folders but not the alias pointers.
    So, since the archive.zip is only 2.1 MB, what conclusion can I draw? Can the compression really squeeze them down that much?

    Dr. Livingstone wrote:
    Question about using the file compression feature within Finder. I understand that when I select multiple files and compress them, it creates a ZIP file with the default name 'archive.zip.' I created a working folder on my desktop and put in about 16 alias of photos that are down in my iPhoto 'originals' folder. When I created the archive.zip, file it was only 2.1 MB (the jpg's varied in size from <1 MB to 3 MB).
    I did this with the presumption that by using aliases in my working folder, the compression utility actually compressed the jpg's in the various folders but not the alias pointers.</div>
    that's wrong. the compression utility compressed the aliases as it should have. if you want to compress the original images that's what you need to put in that folder, not aliases. but keep in mind that jpegs are already compressed so you'll hardly gain any space by compressing them further.
    So, since the archive.zip is only 2.1 MB, what conclusion can I draw? Can the compression really squeeze them down that much?

  • MAC COMPATIBLE file compression FREEware

    Does anyone know of any freeware for compressing video files (for either iPod storage, or of course burning to DVD-R)? My local Apple IT guy told me that "Stuffit" has long been the sort of bona fide software program used for file compression. However, there is a price tag on it.
    I have a very reliable ripping program (Mac the Ripper) in order to back up my purchased DVDs onto my hard drive, but I would like to be able to compress the files so that I can store them in my iPod and take them with me, etc.
    Thanks!

    I would like to be able to compress the files so that I can store them in my iPod and take them with me, etc.
    Do you simply want to compress them to store on the iPod or do you want to view them on the iPod also?
    If you want to simply compress a file, select it in Mac OS X, right click (or option click) File -> Make archive.
    If you want to view it on the iPod
    Get Media Fork.

  • Best File Compression Software

    What is the best file compression software on Mac OSX in terms of both user-friendliness and performance?

    Stuffit Deluxe's native .sitx archives make the smallest files. You can even set the compression rate. Smaller will take more time, but of course, saves more space. It's all I and my client's use. It even compresses .jpg images quite a bit, whereas .zip does almost nothing to them.
    There are drawbacks to all formats, though. Zip and Stuffit both do a lousy job on video files. RAR will usually cut the size down by at least half. But the only way to create RAR files on the Mac is through the Terminal. It astounds me that no one has come up with an OS X native application for this. Or that Stuffit hasn't added it to their choices. Stuffit can open RAR files, so they obviously know how the compression scheme works. Why not add the option to create them?
    As far as someone opening the Stuffit files you create? All a person needs to do is download the free Expander if they don't own Stuffit Deluxe or Standard.

  • File Compression Using ByteArrayInput/OutputStream

    Hi,
    I want to write a File compression program using ByteArrayInput/OutputStream. It should access multiple files and zip the contents of the files and give it in the ByteArrayOutputStream so the user can name that file and store it as zip. How to do this. I have done this with OutputStream. I want the code its very urgent!

    u can use this code to compress and zipping the files
    import java.util.zip.*;
    public class Compress
    public static void doit(String filein[], String filepath[], String fileout)
    // Common Input streams for all the files that will be zipped
    FileInputStream fis = null;
    // Output stream for the ZIP file
    FileOutputStream fos = null;
    try
    fos = new FileOutputStream(fileout);
    // Initialize Zip output stream
    ZipOutputStream zos = new ZipOutputStream(fos);
    // Add entries to the ZIP file
    ZipEntry ze = null;
    // Initialize buffer for the output data
    final int BUFSIZ = 4096;
    byte inbuf[] = new byte[BUFSIZ];
    int n;
    for ( int i = 0; i < filein.length; i++)
    fis = new FileInputStream(filein);
    // Add entries into the ZIP file and give it the display name.
    // Upon unzip the same directory structure as given in the filepath will be followed
    // The file path is the complete path of the file including the file name.
    ze = new ZipEntry(filepath[i]);
    zos.putNextEntry(ze);
    inbuf = new byte[BUFSIZ];
    // write output to the out put stream
    while ((n = fis.read(inbuf)) != -1)
    zos.write(inbuf, 0, n);
    fis.close();
    fis = null;
    zos.close();
    fos = null;
    catch (IOException e)
         System.err.println(e);
    finally
         try
              if (fis != null)
                   fis.close();
         if (fos != null)
         fos.close();
    catch (IOException e)
         System.err.println("\nError Occured while Zipping the files: " + e.getMessage());
    public static void main(String args[])
    // Files to be Zipped
    String filein[] = {"file1.txt", "file2.txt", "file3.txt",};
              // Display name that appears in Win ZIP or any other unzip utility
              String filepath[] = {"temp\\file1.txt", "temp\\file2.txt", "temp\\file3.txt",};
    // Name of the Zip file
    String fileout = "compress.zip";
    // Zip it
    doit(filein, filepath, fileout);

  • Best file compression utility?

    What is the best file compression utility for the mac, and i mean the one that will compress the file the most.
    I want to compress a disk image to make it smaller. I remember downloading a file one time that compressed a dmg even further, but can't remember it.

    yeah i do realize a disk image (dmg) is already compressed, but i swore i found a dmg that was zipped into another format one time that compressed it even further.
    Do you know if the new Stuffit 12 STANDARD does the same compression as DELUXE? i really don't need all the extras deluxe offers for $80....

  • Hey All, what is the best file compression app to compress large video file on my Mac Book Pro?

    Hey All, do you recommend compressor 4 or what is the best file compression app to compress large video file on my Mac Book Pro?

    X,
    Thanks for checking in.  The anwser to your questions are below.
    Where is the material coming from?
    These are MP4 files from my Canon vixia HFR40
    What software are you using to edit the material?
    I am using iMOVIE 9.0.9
    What do you want to do with the files after compression? I want to email I need to have the file be smaller than 100MB to send.
    I am an actor and I video tape my auditions and send them to my agent so I need Highest Quality HD files that have small file sizes, no more than 100MB.  The scenes are like 1-5 Mins long in most cases. Thanks for your help.

  • File Compression program in java

    hello all,
    any idea how to write a file compression program in java.
    any help would be appreciated.
    thanx

    import java.io.*;
    import java.util.zip.*;
    import java.io.File;
    import java.io.FileInputStream;
    import java.util.zip.CRC32;
    import java.util.zip.ZipEntry;
    import java.util.zip.ZipOutputStream;
    import java.util.Date;
    import java.util.Vector ;
    public class FileZip
         //Creating Constructor to pass the vector
         Vector v;
         public FileZip(Vector v, JavaUpload applet){
              this.v = v;
         //Creating Constructor to pass one file
         public FileZip(File file){
              v.addElement(file);
         //default constructor
         public FileZip(){
         public void addFile(File file){
              v.addElement(file);     
         public void removeFile(File file){
              v.removeElement(file);
         ByteArrayOutputStream out;
         //This method helps to zip the files
         public ByteArrayOutputStream doJob(){
                   try {
                   out = new ByteArrayOutputStream();
                   ZipOutputStream zout = new ZipOutputStream(out);
                   zout.setMethod(ZipOutputStream.DEFLATED);
                        for (int i=0; i < v.size(); i++){
                        File file = new File (((File)(v.elementAt(i))).getPath());     
                   byte [] rgb = new byte [1000];
                   int n;
                   FileInputStream fis;
              //Calculate the CRC-32 value.
                   CRC32 crc32 = new CRC32();
                   fis = new FileInputStream(file);
                   while ((n = fis.read(rgb))>-1){
                   crc32.update(rgb, 0, n);
                   fis.close();
              //create a zip entry
                   ZipEntry zipentry = new ZipEntry(file.getName());
                   zipentry.setSize(file.length());
                   zipentry.setTime(file.lastModified());
                   zipentry.setCrc(crc32.getValue());
              //Add the zip entry and associated data
                   zout.putNextEntry(zipentry);
                   fis = new FileInputStream(file);
                   while ((n= fis.read(rgb))>-1){
                   zout.write(rgb,0,n);
                   fis.close();
                   zout.closeEntry();
                   zout.close();
              }catch(ZipException ze){}
              catch(IOException ioe){}     
              return out;

  • Trying to understand, being prompted the file compression rules on saving, or not

    Hello,
    I'm trying to understand something, could I ask for your help, please ?
    After working on a jpg file, when I want to save it, still as jpg, with my Photoshop CS5,
    - sometimes photoshop will just save the picture, and it's done
    - sometimes photoshop will show me the compression dialog, "JPEG Options", in which I can choose the compression ratio, the format options (baseline, baseline optimized, progressive), and have an estimation of the total file size
    While not being prompted any dialog is simpler, and I'll then simply assume Photoshop decides to retain the current image's compression and format rules, I must say I like to be in control, and I'd like to know under what form the file is being saved without having to resort to the much more complex "Save For Web" menu.
    Please, would you know WHAT "triggers" the appearance of the JPEG Options when we close/save a jpeg file, in photoshop ? What makes this menu not to appear, what makes it appear ?
    If there are trivial file operations/changes/filters that necessarily trigger its appearance when we want to save, something like that ? I've tried a variety of these, but I still can't figure it out, sometimes it shows in the end, and sometimes it doesn't.
    Thank you very much if you can help me
    Kind regards,
    Oliver

    @ c.pfaffenbichler
    These are images from various sources, not just one.
    I'm deliberately excluding Save For Web, this completely re-processes everything.
    My purpose, precisely, is to know when photoshop takes the decision to retain the image's "rules", and when photoshop decides to pose us the question, how do we want it saved.
    Simply taking a jpeg image, doing stuff on it, and hitting control-w to close the window, and seeing if it will be an
    - «OK, sure, do you want to save ? You clicked OK to confirm you wanted the changes saved ? Good, now it's closed» or a
    - «please sir, how would you like your image saved, tell me the compression ratio and the format options, thank you»

  • File Compression and FIle Conversion in FCE4

    Hey All,
    I just purchased FCE4 and being the novice that I am, it took me a little while to understand why I kept getting the dreaded "file unknown" errors. I have since figured that out and have figured out how to convert/import files into FCE4.
    Now the tough part...
    I have already started a project and have been cutting old VHS-to-DVD-Ripped from Handbrake into Quicktime movies.
    I guess I saved them in the wrong format/frame rate or something (even though they are .mov) and now am faced with the task of going through 200 clips and exporting/converting into different formats. IS THERE ANY METHOD/PROGRAM where I can just select all of these and convert/export them in the correct format?
    Doing them one by one will take weeks...
    Additionally, since the new files are bigger, when I am exporting from FCE4 to iDVD, does the compression of these files to fit on a DVD seriously affect the quality? The movie will DEFINITELY be over the standard 4.3 Gigs and its already a compilation of home movies so I don't want to destroy the quality too much.
    Any help is greatly appreciated! Thank You!

    There will be quite a bit of degradation of already degrade material. Handbrake unfortunately was not the right tool to use. You'd be best off going back to the DVDs and using MPEG Streamclip to rip them to QuickTime using the DV NTSC codec at 29.97fps.

Maybe you are looking for

  • Receive email attchmnt, store in SAP & link to PO

    Hi Experts, We have a requirement to convert PO to PDF and send it as an e-mail attachment which is possible . But the requirement is to add digital signature to the PO and  send it as E-mail attachment. Also once vendor confirms and signs the same d

  • Is there a free trial for flash professional CS6??

    I need flash professional CS6 for a school assignment and only want a trial...pls help!!

  • IMovie - quick questions about video files when importing and optimizing

    Hi, have some quick questions. I think they are simple. 1. When I import a video (from say iPhoto), where does it get "Move" or "Copy" to? 2. Why would I want to do "Copy" instead of "Move", because isn't it then taking up more space? 3. I'm wonderin

  • SQL 2012 standart. error when installing

    hello there I'm having trouble installing SQL server 2012. it says unauthorized action during process. trying to do repair and no good the error log is here : https://onedrive.live.com/redir?resid=1457F260708DF6F6!84695&authkey=!AEpBM0tn2dv_HHw&ithin

  • WRT54GL loses connection and won't work without a reset

    Hello community, I bought a WRT54GL 2 years ago, and for the first year or so it worked perfectly. About 6 months ago it started losing connection every few weeks; while my inner network looks fine (can ping all machines on 192.168.1.x) the router lo