Reads an existing document.




void Read(string path)
void Read(byte[] data)
void Read(Stream stream)
void Read(string path, string password)
void Read(byte[] data, string password)
void Read(Stream stream, string password)
void Read(string path, XReadOptions options)
void Read(byte[] data, XReadOptions options)
void Read(Stream stream, XReadOptions options)

[Visual Basic]
Sub Read(path As String)
Sub Read(data() As Byte)
Sub Read(stream As Stream)
Sub Read(path As String, password As String)
Sub Read(data() As Byte, password As String)
Sub Read(stream As Stream, password As String)
Sub Read(path As String, options As XReadOptions)
Sub Read(data() As Byte, options As XReadOptions)
Sub Read(stream As Stream, options As XReadOptions)

Throws Exceptions may throw Exception()



Name Description

The file path to the PDF,, SVG, RTF, XPS or other supported document type.


The source PDF data.


The source PDF or document stream.


Any password needed to open the document.


The settings for the read.




Use this method to read a file into a document object. Any existing document content will be discarded. All properties will be set back to their defaults.

You can specify a 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.

You may notice that colors in the PDF files are slightly different if you are reading non-PDF files. PDF handles alpha blending differently from other file formats. Refer to SwfImportOperation.Import for notes about alpha blending.

Other File Types. This method supports the import of a range of other file types as standard.

For the import of doc and docx formats we recommend the use of WordGlue wherever possible. This eliminates the installation and configuration issues which can be associated with other doc import applications.

If is installed you can pass this method a file path to compatible documents. This means you can read file types like Microsoft Word (.doc, .docx), Microsoft Excel (.xls, xlsx), Rich Text Format (.rtf), PowerPoint (.ppt, .pptx), WordPerfect (.wpd), Lotus 1-2-3 (.wk1) and AutoCAD (.dxf).

If both Microsoft Office and .NET 3.5 are installed you can pass this method a path to any Microsoft Office compatible document. By default the Microsoft Office import operation works direct but it can also work via the XPS printer driver if you explicitly specify that the XpsAny read module be used. ABCpdf works with Office 2007 or later.

Rich Text Format (.rtf) documents are automatically imported using the nativeABCpdf Rich Text Format read module. This is generally the simplest, fastest and most reliable import method. However if you have specific needs you can also import them using the or Microsoft Office XReadOptiions.ReadModules.

You can pass this method a file path to an SVG or SVGZ document for conversion to PDF. ABCpdf supports a subset of SVG based around the SVG Tiny specification. For details see the SVG Support section of the documentation. You can also pass a file path to an XPS, OXPS or EPS document for conversion to PDF.

You can use a path to an image type such as JPEG or TIFF. ABCpdf will import multi-page images as multi-page documents. The image types supported are, broadly, those supported by the XImage object.

If you have a stream or data rather than a file path then you will need to specify an options parameter. This is necessary because in the case of data ABCpdf does not have a file extension from which it can automatically decide the type of module to use. As a result it regards all data as PDF unless told otherwise.

Full control over the import process can be implemented by specifying an options parameter. Reading a document without specifying an options parameter is functionally the same as reading a document using a default XReadOptions object.

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 .NET operates an intelligent just-in-time object loading scheme for PDFs 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 Doc object is being used. As a result you cannot modify or overwrite a PDF file while it is read into a Doc object. You will need to save your PDF to another location and then swap the two files around after the Doc object's use of the PDF is ended (with a call to Clear, Dispose, or Read with another PDF file).

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.

Please note that you are legally bound to respect the permissions present in existing PDF documents. For details please see the Legal Requirement Section.

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.

Modifying Documents. ABCpdf will allow you to open, modify and save PDF documents.

ABCpdf will allow you to draw on top of PDF documents or add or delete pages or modify document data. However because of the way that PDF documents are structured it's unlikely that you'll be able to edit existing content.

So if there are blank spaces which you can draw your entries into that will work. Indeed you might want to draw a white box over existing content and then draw on that.

However you shouldn't expect to be able to edit and re-flow text that is already in your PDF.




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


using (Doc doc = new Doc()) {   doc.Read(Server.MapPath("../mypics/sample.pdf"));   doc.FontSize = 500;   doc.Color.String = "255 0 0";   doc.TextStyle.HPos = 0.5;   doc.TextStyle.VPos = 0.3;   int theCount = doc.PageCount;   for (int i = 1; i <= theCount; i++) {     doc.PageNumber = i;     doc.AddText(i.ToString());   }   doc.Save(Server.MapPath("docread.pdf")); }

docread.pdf - [Page 1]

docread.pdf - [Page 2]

docread.pdf - [Page 3]

docread.pdf - [Page 4]