This example shows how to render a PDF document.

For an example of how to render a PDF direct to screen and how to print a PDF see the ABCpdfView project and classes under the ABCpdf menu item.

 

   

Read
 

We create an ABCpdf Doc object and read our source PDF.

[C#]
Doc theDoc = new Doc();
theDoc.Read(Server.MapPath("../Rez/spaceshuttle.pdf"));

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Read(Server.MapPath("../Rez/spaceshuttle.pdf"))

 

   

Prefs
 

We specify our base rendering settings.

[C#]
theDoc.Rendering.DotsPerInch = 36;

[Visual Basic]
theDoc.Rendering.DotsPerInch = 36

 

   

Save
 

Finally we save the first four pages of the document in png format.

[C#]
for (int i = 0; i < 4; i++) {
  theDoc.PageNumber = i;
  theDoc.Rect.String = theDoc.CropBox.String;
  theDoc.Rendering.Save(Server.MapPath("shuttle_p" + i.ToString() +".png"));
}

[Visual Basic]
For i As Integer = 1 To 4
  theDoc.PageNumber = i
  theDoc.Rect.String = theDoc.CropBox.String
  theDoc.Rendering.Save(Server.MapPath("shuttle_p" + i.ToString() + ".png"))
Next

 

   

Results
 


shuttle_p1.gif


shuttle_p2.png


shuttle_p3.png


shuttle_p4.png