Planet PDF Forum Archive

Planet PDF ForumWowsers! This is page is old, head to the LIVE Planet PDF Forum. It features more than 10 conferences, covering everything from beginner to in-depth developer and pre-press discussions. If you wish to continue... one & two archive covers 1999-2011 (160,000 pages).


New Forum | Previous | Next | (P-PDF) Developers


Topic: RE: PDF Optimization
Conf: (P-PDF) Developers, Msg: 58038
From: Deleted User
Date: 5/29/2002 05:29 PM

Jeffrey,

This is quite possible using either C or VB and IAC (InterApplication
Communication).

The process you would have to follow would be:
1. Open PDF
2. Save As... PDF using the Linearised method. (&H4)
3. Close PDF.

You must reference the Acrobat.tlb file for this code to work

If you have any more question feel free to post them.

Dave...............

Here's some VB code to do just that (not tested):
------------------
Public Sub Optimize_PDF()

'/ Declare the Application
Dim Exch As Acrobat.CAcroApp

'/ Holds Information about the PDF document etc
Dim PDDoc As Acrobat.CAcroPDDoc

'/ Get the AViewing Layer
Dim AVDoc As Acrobat.CAcroAVDoc

'/ Assign an instance of the application and Window
'/ also create an instance of the PDDoc Layer to get
'/ to the Document properties
Set Exch = CreateObject("AcroExch.App")
Set AVDoc = CreateObject("AcroExch.AVDoc")
Set PDDoc = CreateObject("AcroExch.PDDoc")

'/ Like it was never there
Exch.Hide

'/ Put the Loop Here to Cycle through files if you wanted
'/ Open an example file. - Change the PDFFile to the name of your PDF file
IsOk = AVDoc.Open(PDFFile, "")
If Not IsOk Then
MsgBox "There was an error opening " & PDFFile & vbCrLf & _
"Currently there is no support for secure/signed PDFs or if your
using Acrobat Reader"
Else
'/ Create an object through the Object Hierarchy
Set PDDoc = AVDoc.GetPDDoc

'/ Here's the magic line - write over the top of the file if you
want
'/ The codes for the different types of save methods
'/ can be found in the IAC.BAS file (from the SDK)
PDDoc.Save &H4, "Newfile.pdf"

'/ Close the file without prompting the user (the file should be
saved)
AVDoc.Close False
End If

'/ Close Acrobat
Exch.Exit

'/ Dispose of the evidence :-)
Set Exch = Nothing
Set PDDoc = Nothing
Set AVDoc = Nothing
End Sub
-----------------------

> -----Original Message-----
> From: p-pdf-developer Listmanager [SMTP:listmanager@www.acrobuddies.com]
> Sent: Friday, December 10, 1999 4:30 AM
> Subject: PDF Optimization
>
> From: "Jeffrey"
>
> ------ AcroBuddies Forum | http://www.acrobuddies.com ------
>
> I am trying to find a way to programmatically optimize an existing PDF
> file. In my code, I talk to a mainframe, which spits out a text file. I
> then use
> PDFlib to turn the text file into a PDF file. But, PDFlib doesn't create
> an optimized file.
>
> Does anyone know of a way to change an existing PDF file to an optimized
> PDF file? This is very important because these reports (sometimes
> hundreds of pages) are displayed on the Internet and users hate to wait
> for the whole thing to download before they can view the first page.
>
> Any help would be greatly appreciated.
>
> ------ Powered by ARTS & http://www.PlanetPDF.com/ ---------
>
> Batch convert images to PDF with a single click...
> http://www.pdfstore.com/mainpage.asp?webpageid=216&pdfsproductid=1005
>
> ------------------------------------------------------------

PDF In-Depth Free Product Trials Ubiquitous PDF

Debenu Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link...

Download free demo

Debenu PDF Tools Pro

It's simple to use and will let you preview and edit PDF files, it's a Windows application that makes...

Download free demo

Back to the past, 15 years ago! Open Publish 2002

Looking back to 2002, it's amazing how much of the prediction became a reality. Take a read and see what you think!

September 14, 2017
Platinum Sponsor





Search Planet PDF
more searching options...
Planet PDF Newsletter
Most Popular Articles
Featured Product

Debenu PDF Aerialist

The ultimate plug-in for Adobe Acrobat. Advanced splitting, merging, stamping, bookmarking, and link control. Take Acrobat to the next level.

Features

Adding a PDF Stamp Comment

OK, so you want to stamp your document. Maybe you need to give reviewers some advice about the document's status or sensitivity. This tip from author Ted Padova demonstrates how to add stamps with the Stamp Tool along with related comments.