Portfolio PDFs

DynamicPDF Rasterizer supports images attached to a PDF as part of a PDF portfolio.

Use the InputPDF class's Attachments property to iterate through the PDF's attachments. For each attachment, call the TryGetPdf method. If the attachment is a PDF, use the PdfRasterizer class's Draw method to rasterize the PDF.

The following two examples demonstrate retrieving and rasterizing PDF attachments from a PDF portfolio.

The TryGetPdf() method does not retrieve non-PDF attachments and instead returns null.

InputPdf portfolioPDF = new InputPdf(pdfFilePath);             
Attachment[] files = portfolioPDF.Attachments;
for(int i =0; i< files.Length; i++)
    InputPdf pdfAttachment = files[i].TryGetPdf();
    if (pdfAttachment != null)
        PdfRasterizer rasterizer = new PdfRasterizer(pdfAttachment);                    
        rasterizer.Draw(@"Attachment" + i.ToString() + ".jpeg", ImageFormat.Jpeg, ImageSize.Dpi72);
Dim portfolioPDF As InputPdf = New InputPdf(pdfFilePath)
Dim files As Attachment() = portfolioPDF.Attachments
For i As Integer = 0 To files.Length - 1
    Dim pdfAttachment As InputPdf = files(i).TryGetPdf()
    If pdfAttachment IsNot Nothing Then
         Dim rasterizer As PdfRasterizer = New PdfRasterizer(pdfAttachment)
         rasterizer.Draw("Attachment" + i.ToString() + ".jpeg", ImageFormat.Jpeg, ImageSize.Dpi72)
     End If

In this topic