Reads an existing PDF.

 

   
Syntax
 
     

Doc.Read PathOrData [, Password]

 

   
Params
 
     
Name   Type   Description
PathOrData Object

The source file path or the source data.

Password String

Any password needed to open the document.

 

   
Notes
 
     

Use this method to read a PDF into a document object. Any existing document content will be discarded.

You can specify the PDF as a file path or by passing in the raw PDF data. Raw data must be held as an array of bytes. You can open encrypted PDF documents if you supply a valid password.

After the read operation is complete the Page property will contain the ID of the first page in the document.

The Rect and MediaBox properties will reflect the size of the first page in the document.

ABCpdf operates an intelligent just-in-time object loading scheme which ensures that only those objects that are required are loaded into memory. This means that if you are modifying large documents then server load will be kept to a minimum. The original PDF document must be available for as long as the Document object is being used.

Object deletion requires that all references to an object are removed. There is no way of doing this without checking each object in the document. So object deletion requires that every object in the document is loaded and for large documents this may place a significant load on the server.

Reading encrypted documents places a greater load on the server because - like object deletion - it requires that every object in the document be loaded.

The Read method may be used to read eForm FDF documents as well as PDF documents. Most PDF operations will not work on FDF documents but you can query field values using the GetInfo methods to return Unicode strings.

 

   
Example
 
     

The following illustrates how one might add a large red number to every page of a PDF document.

Set theDoc = Server.CreateObject("ABCpdf3.Doc")
theDoc.Read "c:\mypics\sample.pdf"
theDoc.FontSize = 500
theDoc.Color = "255 0 0"
theDoc.HPos = 0.5
theDoc.VPos = 0.3
theCount = theDoc.PageCount
For i = 1 To theCount
  theDoc.PageNumber = i
  theDoc.AddText i
Next
theDoc.Save "c:\mypdfs\docread.pdf
"


docsave.pdf [Page 1]

docsave.pdf [Page 2]

docsave.pdf [Page 3]

docsave.pdf [Page 4]


 

   

 

Browser Based Help. Published by chm2web software.