• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Compress PDF from VB.NET

Community Beginner ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

I have also posted a question on reducing the size of a PDF from VB.NET, but that has not gotten any response yet.  Possibly this is equally sufficient for my needs while being easier to answer. 

 

Thank you,

TOPICS
Create PDFs , Edit and convert PDFs

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Hi, 

 

Can you add more details or describe the steps that you are trying to follow?

 

What have you tried before that doesn't work? What applications were used to export to PDF the files that you are trying to reduce in size?

 

Are you looking for an alternate method because you don't have Adobe Acrobat Pro? Has it not worked at all? Have you tried using the online Acrobat compression tool from here https://documentcloud.adobe.com/acrobat/us/en/online/compress-pdf   ?

 

Thank you.

 

Ps- If you are programming Acrobat javascript with visual basic you should look into the the Adobe SDK or Adobe PDF Library from here https://www.adobe.com/devnet/pdf/library.html 

or also check here for oth3er interesting developer resources https://dev.datalogics.com/adobe-pdf-library/ 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Hi, Thanks for the fast reply

We have Acrobat DC Pro.  The applicaiton is written in VB.NET using Visual Studio 2015 (we also have 2019, but I have not personally installed that yet). 

 

I have a reference to Interop.Acrobat in the project.

 

The desired result is to programmatically reduce the size of the PDF(s).  We have three modes of adding PDFs, 

1. Drag and drop into the application, 

2. Convert from Word, Excel, or PowerPoint.

3. Scanned from paper documents. 

 

The third option produces the largest files with many images.  To ensure that the files are reduced it is best to have the program do it rather than rely on the scanner to manually reduce the PDF.  With the programmatic method we can also apply that function to the other two modes.  

 

I posted this here under Compress with the hope that Compression could bring about the same results as the Reduce File size call from the DC application. 

 

Thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Thanks for the interest. I'm doing none of these more complicated tasks, working with nothing but Acrobat DC. All I'm doing is choosing File>Print or choosing Print from a menu -- such as the print option offered alongside a receipt as soon as I pay a bill online. Nothing out of the ordinary. Nothing I haven't been doing for years on end now. Have changed no method. Have changed no routine. PDF still creates and opens when I print from an application. But it has simply stopped opening a new PDF when I print it from anywhere online. This is VERY inconvenient as I use this feature A GREAT DEAL.

 

The solution has to be simple. I just can't find it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

There are a few different ways to use Acrobat DC Professional to reduce file size. And I have to assume that this is what you want to do, to use Acrobat DC Pro programatically through VB.Net to reduce PDF file size. The reason there is more than one option is because reducing PDF file size can be tricky, because PDFs are complicated. If you SaveAs Optimized, Acrobat will display a dialog with a button on the upper right corner labeled "Audit Space Usage". Different styles of PDFs will show different catagories of things that take up space: fonts, images, etc.  Then you can choose from various options, such as removing fonts and resampling images.  

 

About compression. Compress what?  Acrobat already uses compression for all data streams. The type of compression it uses depends on a number of factors, such as data type, and version of Acrobat. Later versions of Acrobat use some differnet techniques for organizing and compressing streams. It's possible you could get better results with different methods, but this is hard to control from the options avaliable in the UI. Unless you are talking about images.

 

It seems to me, that in your case, you want to resample images and convert to a differnet (compression) format. This is an option on the "SaveAs Optimized" operation, but there is no way to access this operation through an external VB program. But there is a way, which is to use Preflight. This is a multistep process.

1. Create your own Preflight profile that performs the exact opteration that will reduce your scanned files.

2.  Write an Acrobat folder level function (JavaScript) that will apply this profile. 

3.  Use the Acrobat IAC to execute this function from your VB.Net application.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Thanks for your interest, but I don't have a clue how or why my question ended up over here in your section. I've never mentioned the word "compression" in my original question, and I'm not trying to compress anything.

 

I'm just trying to flat-out print like I have for years and years and years now from within my browser. I just want a dirt-plain PDF of what I have on screen, to save for my records. I'm not trying to do anything fancy. You don't need to spend time trying to tell me how to do all this compression stuff because I'm not trying to do anything like that at all.

 

On the other hand, when I work in my graphics programs (I'm a designer), I know how to compress my graphics and my PDFs. That is not what I need. That is NOWHERE NEAR my problem. Thanks for your help, but I'm definitely in the wrong section here! I'd really hoped to hear from someone about what I actually asked about.

 

I hope that you didn't actually transfer my whole question to this section. If so, can you please move it back??!!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Thank you.  I have not created a Preflight Profile before or performed any of the 3 items in the list you provided, but I am looking into it.  This will also help with flattening files so win win.   Are there any tutorials I could use for these that you would recommend? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 05, 2019 Nov 05, 2019

Copy link to clipboard

Copied

Just this one:

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FIAC_DevApp_...

 

Not really a tutorial. 

You'll also need the Preflight function 

https://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/#t=Acro12_MasterBook%2FJS_API_Acro...

 

And here's a little tutorial on different ways to Automate Acrobat:

https://www.pdfscripting.com/public/Automating-Acrobat.cfm

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 26, 2019 Nov 26, 2019

Copy link to clipboard

Copied

My apologies. This solution is not working for me. 

 

I found no help in how to create a Preflight Profile in Acrobat DC. That being the first step quickly derailed my attempts to get something going. 

Trying to create a Folder Level script and access it for what I need instead of adding a menu item was also not fruitful.  

 

We have PDFs that are too large for sending via email or downloading from a remote server within a tolerable amount of time.  We are asking the people who scan these documents to perform the reduction manually, but it would be nice to do this automatically.  

 

What is called when a user manually selects "File - Save As Other - Reduced Size PDF"?  Is that a JavaScript call?  Can I use that from Acrobat IAC? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 26, 2019 Nov 26, 2019

Copy link to clipboard

Copied

LATEST

++Adding to the discussion,

 

You may instruct the users to batch process files using the Action Wizard in Acrobat Pro https://helpx.adobe.com/acrobat/using/action-wizard-acrobat-pro.html

 

This, however, is not an a script per se but it does automates the processing of many files with some desired results.

 

The user manual intervention to achieve the results that you're looking for still involves a series of many steps that may be hard to achieve under one single  instruction set, meaning that, making a button clickable just to execute the desired file reduction may not result  in the same output (nor apply ) for each PDF files that could've been created using different source  programs .

 

If a user uses Save As Other to reduce file size , they will have to also combine other actions like Optimize, play around with transparency flattener presets, or even just saving as another file type to achieve a desired result.

 

 

 

 

 

 

 

 

In my non-developer and very humble opinion,   what you're trying to incorporate in your VB.NET application may be achieved with batch scripting using something like ps2pdf in combination with the Acrobat Distiller Parameters. See here: http://web.mit.edu/ghostscript/www/Ps2pdf.htm

 

You may, however, run into  a few quality degradation issues and possibly destruction of digital signatures applied to a PDF document, since it involves postscripting.

 

I am not sure if this is true  as compared with ghostscript; I've read in forums outside of this one of a user trying to compress (or reduce large PDF files that had digital signatures) using ghostscript and  it destroyed the signatures.In any case, from what I've been reading, ps2pdf   seems to be more robust than ghostscript to generate batch scripts that will take the Acrobat Distiller parameters.

 

You may also consider  using JAVA (not javascripting), like Aspose.PDF for Java, processing API library. And see how it works with your your VB.NET application to manipulate the loading, modification and  conversion of your files .

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines