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 doc = new Doc();
doc.Read(Server.MapPath("../Rez/spaceshuttle.pdf"));


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

 

   

Prefs
 

We specify our base rendering settings.

[C#]

doc.Rendering.DotsPerInch = 36;


[Visual Basic]
doc.Rendering.DotsPerInch = 36

 

   

Save
 

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

[C#]

for (int i = 1; i <= 4; i++) {
  doc.PageNumber = i;
  doc.Rect.String = doc.CropBox.String;
  doc.Rendering.Save(Server.MapPath("shuttle_p" + i.ToString() +".png"));
}


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

 

   

Results
 


shuttle_p1.gif


shuttle_p2.png


shuttle_p3.png


shuttle_p4.png