Back to Devexpress

PdfDocumentProcessor.Document Property

officefileapi-devexpress-dot-pdf-dot-pdfdocumentprocessor.md

latest5.7 KB
Original Source

PdfDocumentProcessor.Document Property

Provides access to a PdfDocument class, which represents the current document.

Namespace : DevExpress.Pdf

Assembly : DevExpress.Docs.v25.2.dll

NuGet Package : DevExpress.Document.Processor

Declaration

csharp
public PdfDocument Document { get; }
vb
Public ReadOnly Property Document As PdfDocument

Property Value

TypeDescription
PdfDocument

A current document.

|

Remarks

Use the Document property to access the current PDF document.

The PdfDocument object allows you to access the document’s pages (the PdfDocument.Pages property), bookmarks (the PdfDocument.Bookmarks property), file attachments (the PdfDocument.FileAttachments property), interactive forms (the PdfDocument.AcroForm property), etc.

The code sample below shows how to access the current document and rotate all pages.

The code sample below rotates all document pages.

View Example: How to rotate PDF pages

csharp
using DevExpress.Pdf;

using (PdfDocumentProcessor pdfDocumentProcessor = new PdfDocumentProcessor())
{
    pdfDocumentProcessor.LoadDocument("..\\..\\docs\\TextRotate.pdf");
    int angle = 0;
    foreach (PdfPage page in pdfDocumentProcessor.Document.Pages)
    {
        angle = (angle + 90) % 360;
        page.Rotate = angle;
    }
    pdfDocumentProcessor.SaveDocument("..\\..\\docs\\Rotated.pdf");
}
vb
Imports DevExpress.Pdf

Using pdfDocumentProcessor As New PdfDocumentProcessor()
    pdfDocumentProcessor.LoadDocument("..\..\docs\TextRotate.pdf")
    Dim angle As Integer = 0
    For Each page As PdfPage In pdfDocumentProcessor.Document.Pages
        angle = (angle + 90) Mod 360
        page.Rotate = angle
    Next page
    pdfDocumentProcessor.SaveDocument("..\..\docs\Rotated.pdf")
End Using

The following code snippets (auto-collected from DevExpress Examples) contain references to the Document property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

pdf-document-api-xmp-example/CS/XmpMetadataExamples/Program.cs#L23

csharp
pdfDocumentProcessor.LoadDocument("Documents//Invoice.pdf");
PdfDocument document = pdfDocumentProcessor.Document;

pdf-document-api-custom-properties/CS/pdf-custom-properties/Program.cs#L18

csharp
pdfProcessor.LoadDocument("PageDeletion.pdf");
ModifyCustomProperties(pdfProcessor.Document);
pdfProcessor.SaveDocument("Result.pdf");

asp-net-web-forms-implement-pdf-viewer/CS/PdfViewer.ascx.cs#L88

csharp
protected void BindDataView() {
    if (DocumentProcessor.Document != null) {
        List<PdfPageItem> data = new List<PdfPageItem>();

pdf-document-api-xmp-example/VB/XmpMetadataExamples/Program.vb#L19

vb
pdfDocumentProcessor.LoadDocument("Documents//Invoice.pdf")
Dim document As PdfDocument = pdfDocumentProcessor.Document
' Retrieve metadata:

pdf-document-api-custom-properties/VB/pdf-custom-properties/Program.vb#L14

vb
pdfProcessor.LoadDocument("PageDeletion.pdf")
ModifyCustomProperties(pdfProcessor.Document)
pdfProcessor.SaveDocument("Result.pdf")

asp-net-web-forms-implement-pdf-viewer/VB/PdfViewer.ascx.vb#L95

vb
Protected Sub BindDataView()
    If Me.DocumentProcessor.Document IsNot Nothing Then
        Dim data As System.Collections.Generic.List(Of E5095.PdfViewer.PdfPageItem) = New System.Collections.Generic.List(Of E5095.PdfViewer.PdfPageItem)()

See Also

PdfDocumentProcessor Class

PdfDocumentProcessor Members

DevExpress.Pdf Namespace